VOOZH about

URL: https://www.geeksforgeeks.org/cpp/ios-manipulators-unitbuf-function-in-c/

⇱ ios manipulators unitbuf() function in C++ - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

ios manipulators unitbuf() function in C++

Last Updated : 12 Jul, 2025
The unitbuf() method of stream manipulators in C++ is used to set the unitbuf format flag for the specified str stream. This flag flushes the associated buffer after each operation. Syntax:
ios_base& unitbuf (ios_base& str)
Parameters: This method accepts str as a parameter which is the stream for which the format flag is affected. Return Value: This method returns the stream str with unitbuf format flag set. Example 1:
Output:
unitbuf flag: G
F
G
Example 2:
Output:
unitbuf flag: G
E
E
K
S
Reference: https://cplusplus.com/reference/ios/unitbuf/
Comment
Article Tags: