From the man page for scanf and friends, we notice that scanf knows to read
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 :
scanf ("%d", &num);
fscanf(stdin, "%d", &num);
Similarities also exist with the printf and fprintf functions.
So the following statements are equivalent :
printf ("num = %d\n", num);
fprintf (stdout, "num = %d\n", num);