A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://en.cppreference.com/w/cpp/language/../error/error_code/../../../cpp/io/manip/flush.html below:

std::flush - cppreference.com

Flushes the output sequence os as if by calling os.flush().

This is an output-only I/O manipulator, it may be called with an expression such as out << std::flush for any out of type std::basic_ostream.

[edit] Notes

This manipulator may be used to produce an incomplete line of output immediately, e.g. when displaying output from a long-running process, logging activity of multiple threads or logging activity of a program that may crash unexpectedly. An explicit flush of std::cout is also necessary before a call to std::system, if the spawned process performs any screen I/O (a common example is std::system("pause") on Windows). In most other usual interactive I/O scenarios, std::endl is redundant when used with std::cout because any input from std::cin, output to std::cerr, or program termination forces a call to std::cout.flush().

When a complete line of output needs to be flushed, the std::endl manipulator may be used.

When every output operation needs to be flushed, the std::unitbuf manipulator may be used.

[edit] Parameters os - reference to output stream [edit] Return value

os (reference to the stream after manipulation).

[edit] Example

Without std::flush, the output would be the same, but may not appear in real time.

Possible output:

567ms ... 1137ms ... 1707ms ... 2269ms ... 2842ms ...
[edit] See also controls whether output is flushed after each operation
(function) [edit] outputs '\n' and flushes the output stream
(function template) [edit] synchronizes with the underlying storage device
(public member function of std::basic_ostream<CharT,Traits>) [edit]

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4