Program #include <stdio.h> void main() { FILE *fp; char ch; //write a character to a file fp = fopen("file.c", "w"); fputc('a', fp); fclose(fp); //read a character from a file fp = fopen("file.c", "r"); while((ch = fgetc(fp)) != EOF) { printf("%c", ch); } fclose(fp); printf("\n"); } Output:a
#include <stdio.h> void main() { FILE *fp; char ch; //write a character to a file fp = fopen("file.c", "w"); fputc('a', fp); fclose(fp); //read a character from a file fp = fopen("file.c", "r"); while((ch = fgetc(fp)) != EOF) { printf("%c", ch); } fclose(fp); printf("\n"); }