Although we can handle most I/O routines with getc and putc , there are file versions of fgets, fputs, fprintf and fscanf . The syntax is
fgets(stringname,n,filename);
This reads n-1 characters form the filename into the stringname variable
fputs(stringname,filename);
This writes the contents of the stringname to the filename channel
fscanf(filename,"format",&variables);
This is identical to scanf except that the data is read from the filename
fprintf(filename,"format",variables);
This is a file write function to store raw binary data
fwrite(filename,"format",variables);
This is a file read function to read raw binary data
fread(filename,"format",variables);
These I/O functions are actually the original I/O functions and printf etc are a simplified sub set of I/O. The VDU and keyboard defined as streams namely stdout and stdin. Therefore within C we have re-defined the following function i.e
fprintf(stdout,"format",variables);
to
printf("format",variables);
Likewise we have
scanf subset of fscanf File is stdin
getchar subset of getc File is stdin
putchar subset of putc File is stdout
puts subset of fputs File is stdout
gets subset of fgets File is stdin