Reads input through the console (e.g. Keyboard input). Used in C with scanf
scanf(<formatstring>,<pointer to storage> ...);
Produces output to the console. Used in C with printf
printf(<string>, <values to print> ...);
Produces 'error' output to the console. Used in C with fprintf
fprintf(stderr, <string>, <values to print> ...);
The source for stdin can be redirected. For example, instead of coming from keyboard input, it can come from a file (echo < file.txt
), or another program ( ps | grep <userid>
).
The destinations for stdout, stderr can also be redirected. For example stdout can be redirected to a file: ls . > ls-output.txt
, in this case the output is written to the file ls-output.txt
. Stderr can be redirected with 2>
.