The Linux system treats all the devices as files.
stdin standard input Stream default keyboard
STDOUT standard output stream default display terminal
STDERR standard error stream
Prototypes of scanf and printf
Run test results
Output redirection
Redirect the contents of the a.out output to A.txt
./a.out 1>> a.txt Append the output to the end of the A.txt
./a.out 1> a.txt overwrite the output a.txt
"1" can be omitted
Input redirect
./a.out 1< input.txt//input contents as parameters to be accepted by a.out
Same < coverage
<< not covered
Error stream redirection
PS: Error stream must return error code 1;
Normal state:
If the denominator is 0:
Error is 1 with Echo
Summarize:
1> A.txt represents a standard output stream, 2>b.txt represents a standard error stream, and <c.txt represents a standard input stream
Standard input stream output stream error stream