/* Example:how to read from a file in C language */ #include <stdio.h> #include <stdlib.h> int main(){ // Open file in read-only mode FILE *in=fopen("filename.txt","r"); char c; while((c=fgetc(in))!=EOF) putchar(c); fclose(in); // close the file return 0; }Source:ww.wlautturi.com
Note that the parameters in fopen use double quotation marks. exceptions will occur if single quotation marks are used.