ios manipulators unitbuf() function in C++ Last Updated : 28 Aug, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report 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: CPP // C++ code to demonstrate // the working of unitbuf() function #include <iostream> #include <sstream> using namespace std; int main() { // Initializing the character char a, b, c; // Stream input with leading whitespaces istringstream iss("GFG"); // Using unitbuf() // buffer flushed 3 times iss >> unitbuf >> a >> b >> c; cout << "unitbuf flag: " << a << endl << b << endl << c << endl; return 0; } Output: unitbuf flag: G F G Example 2: CPP // C++ code to demonstrate // the working of unitbuf() function #include <iostream> #include <sstream> using namespace std; int main() { // Initializing the character char a, b, c, d, e; // Stream input with leading whitespaces istringstream iss("GEEKS"); // Using unitbuf() // buffer flushed 5 times iss >> unitbuf >> a >> b >> c >> d >> e; cout << "unitbuf flag: " << a << endl << b << endl << c << endl << d << endl << e << endl; return 0; } Output: unitbuf flag: G E E K S Reference: http://www.cplusplus.com/reference/ios/unitbuf/ Comment More infoAdvertise with us Next Article ios manipulators right() function in C++ G guptayashgupta53 Follow Improve Article Tags : Misc C++ cpp-ios cpp-manipulators Practice Tags : CPPMisc Similar Reads ios manipulators nounitbuf() function in C++ The nounitbuf() method of stream manipulators in C++ is used to clear the showbase format flag for the specified str stream. This flag does not flushes the associated buffer after each operation. Syntax: ios_base& nounitbuf (ios_base& str) Parameters: This method accepts str as a parameter w 2 min read ios manipulators right() function in C++ The right() method of stream manipulators in C++ is used to set the adjustfield format flag for the specified str stream. This flag sets the adjustfield to right. It means that the number in the output will be padded to the field width by inserting fill characters at the start. Syntax: ios_base& 1 min read ios manipulators oct() function in C++ The oct() method of stream manipulators in C++ is used to set the baseline format flag for the specified str stream. This flag sets the baseline for Octal numbers. Hence the output shows the number in Octal base. Syntax: ios_base& oct (ios_base& str) Parameters: This method accepts str as a 1 min read ios manipulators scientific() function in C++ The scientific() method of stream manipulators in C++ is used to set the floatfield format flag for the specified str stream. This flag sets the floatfield to scientific. It means that, the floating point values will be written in scientific notations. Syntax: ios_base& scientific (ios_base& 2 min read ios manipulators noskipws() function in C++ The noskipws() method of stream manipulators in C++ is used to clear the showbase format flag for the specified str stream. This flag reads the whitespaces in the input stream before the first non-whitespace character. Syntax: ios_base& noskipws (ios_base& str) Parameters: This method accept 2 min read ios manipulators showpoint() function in C++ The showpoint() method of stream manipulators in C++ is used to set the showpoint format flag for the specified str stream. This flag always displays the floating point values along with their decimal values. Syntax: ios_base& showpoint (ios_base& str) Parameters: This method accepts str as 1 min read Like