Javatpoint Logo
Javatpoint Logo

C++ Manipulator unitbuf

C++ manipulator unitbuf function is used to set the unitbuf format flag for the str stream.

When we set unitbuf format flag, then it enables automatic flushing of the output stream after any output operation. It has no effect on input.

Syntax

Parameter

str: stream object whose format flag is affected.

Return value

It returns argument str.

Data Races

Data races may occur when modifies str concurrent access to the same stream object.

Exceptions

str is in a valid state, if an exception is thrown.

Example 1

Let's see the simple example to demonstrate the use of unitbuf:

Output:

Note: - There is no output.

Example 2

Let's see another simple example:

Output:

..(428 ms)....(853 ms)....(1281 ms)....(1708 ms)....(2131 ms)..
Next TopicC++ Manipulator





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA