object
stdin
<cstdio>
Standard input stream
The standard input stream is the default source of data for applications. It is usually directed to the input device of the standard console (generally, a keyboard).
stdin can be used as an argument for any function that expects an input stream as one of its parameters, like
fgets or
fscanf.
Although it is generally safe to assume that the source of data for
stdin is going to be a keyboard, bear in mind that this may not be the case even in regular console systems, since
stdin can be redirected at the operating system level. For example, many systems, among them DOS/Windows and most UNIX shells, support the following command syntax:
myapplication < example.txt
to use the content of the file
example.txt as the primary source of data for
myapplication instead of the console keyboard.
It is also possible to redirect
stdin to some other source of data from within a program using the
freopen function.