getc() and putc() functions In C Language
The getc and putc functions are analogous to getchar and putchar functions and handle one character at a time. The putc function writes the character contained in character variable c to the file associated with the pointer fp1. ex putc(c, fpl); similarly getc function is used to read a character from a file that has been open in read mode. c=getc(fp2).
Program : The following program is an example to read a character from a file and to write a character into a file
FILE *fl; 
char c;
printf(“Data input”); 
fl =fopen(“Input.txt”, “w”);		 /*Open the file Input*/
while((c=getchar())!=EOF) 		/*get a character from key board*/
putc( c, fl);			 	//write a character to input
fclose(fl);				 //close the file input
printf(‘Data output”); 
fl =fopen(‘INPUT.txt” ,”r”); //Reopen the file input
while((c=getc(fl ))!=EOF) 
printf(“%c”, c ); 
fclose(fl );