First you need to create a file test.txt
code:-
#include<stdio.h> int main(){ FILE *fp; char ch; fp=fopen("test.txt","r"); if(fp==NULL){ printf("File error"); exit(0); } ch = fgetc(fp); while(ch != EOF){ printf("%c",ch); ch=fgetc(fp); } fclose(fp); return 0; }
Post a Comment
If you have any doubts, Please let me know
Thanks!