char * temp_ptr; FILE * fp; fp = fopen ("test.txt", "r"); if (fp == NULL) { printf ("error: file not found"); exit (1); } while (!feof (fp)) { fgets (temp_ptr, 1024, fp); printf ("\n\ndata so far: %s\n\n", temp_ptr); } fclose (fp);