how would i write a program that could read an unknown amount of lines from an external text file? where a string would read each line individually in a loop?
Printable View
how would i write a program that could read an unknown amount of lines from an external text file? where a string would read each line individually in a loop?
using
while(fgets(...))
loop
ok... sounds good but how would i get the while loop to stop?
have you read the fgets function description? It will return NULL when read fails - for example due to end-of-file condition. Thus while loop will end