C + + system pre-defined 4 for standard data flow objects

Source: Internet
Author: User

C + + system pre-defined 4 for standard data flow objects

CIN cout Cerr Clog

C + + in the cerr,clog, cout three differences:
Cerr (No buffer standard error)-----without buffering, the content sent to it is immediately output
Clog (with buffer standard error)--------buffer, buffer full-time output
cout-------------------------Standard Output

Contact: Three each is an output stream object defined by the Ostream class,

Cout is in the terminal display output, the cout stream in memory corresponds to open up a buffer, used to store the data in the stream,

However, when a endl is inserted into the cout stream, all data in the stream is immediately output, regardless of whether the buffer is diffuse, and then a newline character is inserted.
The Cerr Stream object is the standard error stream, which is specified as associated with the monitor, and the cout function is similar, a little different is cout
It is usually transmitted to the display output, but can be redirected to a file, and the information in the Cerr stream can only be output on the monitor.
The clog stream is also a standard error stream, with the same effect as Cerr , except that the Cerr does not pass through the buffer and outputs the information directly to the monitor, and the information in the clog is stored in the buffer, Output when the buffer is full or when Endl is encountered.

C + + system pre-defined 4 for standard data flow objects

Related Article

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.