0

The man page of 'sscanf' says:

"EOF is also returned if a read error occurs, in which case the error indicator for the stream (see ferror(3)) is set, and errno is set indicate the error"

I am confused that what kind of read error may occur if sscanf is reading from a buffer on stack???

3
Contributors
3
Replies
4
Views
8 Years
Discussion Span
Last Post by me_ansh
0

ok, Let me elaborate, i have a text file that contains lines like:

ABCD 6 0
EFGH 1 0

and so on.....

what i do is, i read each line using 'fgets()' in a char buffer say read_buff, apply a regular expression over it, that ensures the presence of two integers after the name, now by using sscanf i am reading the integers into integer variables, my question is that should i handle the read error specified in man pages, if yes, then please tell me the scenario in which it may occur....

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.