I just found this example in my book.
After running the program in will only ready the first line of my file.
Ex. inside my file "PhoneBook.txt"
Mine 12345678
Hers 1234567
Them 123456
It will only read "Mine 12345678" ignoring "Hers 1234567 and Them 123456" How will i'll make this program ready all the text inside my file?
#include <stdio.h>
#include <string.h>
main()
{
FILE *file;
char temp[190];
if ((file = fopen("PhoneBook.txt", "r")) != NULL)
{
if(fgets(temp, sizeof(temp), file) != NULL)
{
printf("%s", temp);
fclose(file);
}
else printf("ERRor");
}
else printf("error");
getchar();
getchar();
return 0;
}