0

Trying to read strings from file in the [load] function of speller. When using fscanf(), how do I start a while loop until it returns "EOF"? I think there's got to be an easy way to do this, so any help would be greatly appreciated.

Thanks!

1
  • hint. read the man pages on fscanf, particularly the return values. – Cliff B Jul 19 '20 at 5:51
1
fscanf 

Returns the number of data it has read while EOF is just an indicator which is used to indicate end of the file so you can make something like this

while(fscanf(_something_) != EOF)

{ 
// do something
}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .