Standard input stream output stream error stream

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.