/* Reading a text file. */ #include int main() { FILE *ptr_file; char buf[1000]; /* can store strings up to 999 chars long */ ptr_file = fopen("input.txt","r"); if (!ptr_file) { return 1; } while (fgets(buf,1000, ptr_file) != NULL) { printf("%s",buf); } fclose(ptr_file); return 0; }