fbpx

C++: Standard Error

Bjarne-stroustrup
 

A common practice in computing is to send error messages to a different output stream than normal text console messages.

The normal messages print to what is called “standard output” or “standard out”. The error messages print to “standard error”.

This separation can be used to redirect error messages to a different place than normal messages.

Show how to print a message to standard error by printing “Goodbye, World!” on that stream.

#include <iostream>

int main () {
	std::cerr << "Goodbye, World!\n";
}

SOURCE

Content is available under GNU Free Documentation License 1.2.