#include<stdio.h> void read() { int i=0 , j=0; char s[10]; FILE *fp ; fp = fopen ( "sig.c" , "w+" ); if (fp==NULL) {fputs("File error",stderr); exit (1);} fgets (s , 10 , fp) ; printf("%s \n",s); fclose(fp); } void write() { char x1[10] ; int i =0 ; char c = ""; FILE *fp; fp=fopen("sig.c", "wb"); for (i=0 ; i< 10 ;i++) { x1[i] = scanf("%c" , &c); } char x="f" , x2 = ""; for (i=0 ; i< 10 ;i++) { x2 = x1[i]; fwrite(&x2, sizeof(x2) , x ,fp); } fclose(fp); } void main() { write(); read(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)