This document discusses file handling in C using functions like fopen(), fclose(), fread(), fwrite(), getc(), putc(), fprintf(), and fscanf(). It explains that files can be opened in different modes (read, write, append) and accessed using pointers to read or write data like characters, integers, and blocks of memory. Functions like fread() and fwrite() allow reading and writing arrays or blocks of data at once from files.
9. #include <stdio.h>
main()
{
FILE *fp1;
char c;
f1= fopen(“INPUT”, “w”); /* open file for writing */
while((c=getchar()) != EOF) /*get char from keyboard until CTL-Z*/
putc(c,f1); /*write a character to INPUT */
fclose(f1); /* close INPUT */
f1=fopen(“INPUT”, “r”); /* reopen file */
while((c=getc(f1))!=EOF) /*read character from file INPUT*/
printf(“%c”, c); /* print character to screen */
fclose(f1);
} /*end main */