#include #include #include // This program read strings (whole lines) form a text file. // It uses fgets instead of fscanf to achieve that. // Note the new line (\n) at the end of each line is part of the string too. int main() { FILE* fp; int a, b; if( (fp = fopen("strings.txt", "r")) == NULL) { printf("File not found!\n"); } else { int result; char STRING[1024]; while( fgets(STRING, 1024, fp) != NULL) // read at most 1024 characters from fp and store them in STRING { printf("[%s]\n", STRING); } fclose(fp); } system("pause"); }