[std.manip] # 31 Input/output library [[input.output]](./#input.output) ## 31.7 Formatting and manipulators [[iostream.format]](iostream.format#std.manip) ### 31.7.7 Standard manipulators [std.manip] [1](#1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L7192) The header [](iomanip.syn#header:%3ciomanip%3e "31.7.3 Header synopsis [iomanip.syn]") defines several functions that support extractors and inserters that alter information maintained by classios_base and its derived classes[.](#1.sentence-1) [🔗](#lib:resetiosflags) `unspecified resetiosflags(ios_base::fmtflags mask); ` [2](#2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L7203) *Returns*: An object of unspecified type such that if out is an object of typebasic_ostream then the expressionout << resetiosflags(mask) behaves as if it calledf(out, mask), or if in is an object of typebasic_istream then the expressionin >> resetiosflags(​mask) behaves as if it calledf(in, mask), where the function f is defined as:[291](#footnote-291 "The expression cin >> resetiosflags(ios_­base​::​skipws) clears ios_­base​::​skipws in the format flags stored in the basic_­istream object cin (the same as cin >> noskipws), and the expression cout << resetiosflags(ios_­base​::​showbase) clears ios_­base​::​showbase in the format flags stored in the basic_­ostream object cout (the same as cout << noshowbase).")void f(ios_base& str, ios_base::fmtflags mask) {// reset specified flags str.setf(ios_base::fmtflags(0), mask);} The expression out << resetiosflags(mask) has type basic_ostream& and value out[.](#2.sentence-2) The expression in >> resetiosflags(mask) has typebasic_istream& and value in[.](#2.sentence-3) [🔗](#lib:setiosflags) `unspecified setiosflags(ios_base::fmtflags mask); ` [3](#3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L7242) *Returns*: An object of unspecified type such that ifout is an object of typebasic_ostream then the expressionout << setiosflags(mask) behaves as if it calledf(out, mask), or ifin is an object of typebasic_istream then the expressionin >> setiosflags(mask) behaves as if it calledf(in, mask), where the function f is defined as: [🔗](#lib:fmtflags,ios_base) void f(ios_base& str, ios_base::fmtflags mask) {// set specified flags str.setf(mask);} The expressionout << setiosflags(mask) has typebasic_ostream& and valueout[.](#3.sentence-2) The expressionin >> setiosflags(mask) has typebasic_istream& and valuein[.](#3.sentence-3) [🔗](#lib:setbase) `unspecified setbase(int base); ` [4](#4) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L7288) *Returns*: An object of unspecified type such that ifout is an object of typebasic_ostream then the expressionout << setbase(base) behaves as if it calledf(out, base), or ifin is an object of typebasic_istream then the expressionin >> setbase(base) behaves as if it calledf(in, base), where the function f is defined as:void f(ios_base& str, int base) {// set basefield str.setf(base == 8 ? ios_base::oct : base == 10 ? ios_base::dec : base == 16 ? ios_base::hex : ios_base::fmtflags(0), ios_base::basefield);} The expressionout << setbase(base) has typebasic_ostream& and valueout[.](#4.sentence-2) The expressionin >> setbase(base) has typebasic_istream& and valuein[.](#4.sentence-3) [🔗](#lib:setfill) `unspecified setfill(char_type c); ` [5](#5) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L7336) *Returns*: An object of unspecified type such that ifout is an object of typebasic_ostream and c has typecharT then the expressionout << setfill(c) behaves as if it calledf(out, c), where the function f is defined as:templatevoid f(basic_ios& str, charT c) {// set fill character str.fill(c);} The expressionout << setfill(c) has typebasic_ostream& and valueout[.](#5.sentence-2) [🔗](#lib:setprecision) `unspecified setprecision(int n); ` [6](#6) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L7370) *Returns*: An object of unspecified type such that ifout is an object of typebasic_ostream then the expressionout << setprecision(n) behaves as if it calledf(out, n), or ifin is an object of typebasic_istream then the expressionin >> setprecision(n) behaves as if it calledf(in, n), where the function f is defined as:void f(ios_base& str, int n) {// set precision str.precision(n);} The expressionout << setprecision(n) has typebasic_ostream& and valueout[.](#6.sentence-2) The expressionin >> setprecision(n) has typebasic_istream& and valuein[.](#6.sentence-3) [🔗](#lib:setw) `unspecified setw(int n); ` [7](#7) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L7415) *Returns*: An object of unspecified type such that ifout is an instance ofbasic_ostream then the expressionout << setw(n) behaves as if it calledf(out, n), or ifin is an object of typebasic_istream then the expressionin >> setw(n) behaves as if it calledf(in, n), where the function f is defined as:void f(ios_base& str, int n) {// set width str.width(n);} The expressionout << setw(n) has typebasic_ostream& and valueout[.](#7.sentence-2) The expressionin >> setw(n) has typebasic_istream& and valuein[.](#7.sentence-3) [291)](#footnote-291)[291)](#footnoteref-291) The expression cin >> resetiosflags(ios_base​::​skipws) clears ios_base​::​skipws in the format flags stored in thebasic_istream object cin (the same ascin >> noskipws), and the expressioncout << resetiosflags(ios_base​::​showbase) clears ios_base​::​showbase in the format flags stored in the basic_ostream objectcout (the same as cout << noshowbase)[.](#footnote-291.sentence-1)