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?
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
All problems in computer science can be solved by another level of indirection,
except for the problem of too many layers of indirection.
– David J. Wheeler
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
All problems in computer science can be solved by another level of indirection,
except for the problem of too many layers of indirection.
– David J. Wheeler