G
gio
suppose I have:
....
char str1[LEN1];
char str2[LEN2];
int ret;
fgets(str1, LEN, stdin); //str1 can contain just '\n' and '\0'
ret=sscanf(str1, "%s", str2);
....
The sscanf man page specifies that "...this function return EOF if the
end of input is reached before the first conversion. EOF is also
returned if a read error occur, in which case the error indicator of
the stream is set(see ferror(3))...".
If ret = EOF after sscanf I want know if the end of input is reached
or if a read error occur, but I don't understand how I must call
ferror (int ferror(FILE *stream)), because I don't read from a file.
Someone can help me please?
thanks
....
char str1[LEN1];
char str2[LEN2];
int ret;
fgets(str1, LEN, stdin); //str1 can contain just '\n' and '\0'
ret=sscanf(str1, "%s", str2);
....
The sscanf man page specifies that "...this function return EOF if the
end of input is reached before the first conversion. EOF is also
returned if a read error occur, in which case the error indicator of
the stream is set(see ferror(3))...".
If ret = EOF after sscanf I want know if the end of input is reached
or if a read error occur, but I don't understand how I must call
ferror (int ferror(FILE *stream)), because I don't read from a file.
Someone can help me please?
thanks