UMBC CMSC 201 Fall '06 CSEE | 201 | 201 F'06 | lectures | news | help |
From the man page for scanf( ), we notice that scanf reads from the standard input stream, whereas fscanf( ) takes the stream from which to read as its first argument, in the form of a FILE pointer.
int scanf(const char *format, ...); int fscanf(FILE *strm, const char *format,...); scanf reads from the standard input stream, stdin. fscanf reads from the stream strm.
So the following statements are equivalent :
Similarities also exist with the printf and fprintf functions. So the following statements are equivalent :
Now that you know about, stderr, it is good programming practice
to print error messages to stderr, rather than to stdout.
So rather than using the following :