std::resetiosflags
提供: cppreference.com
ヘッダ <iomanip> で定義
|
||
/*unspecified*/ resetiosflags( std::ios_base::fmtflags mask ); |
||
式 out << resetiosflags(mask) または in >> resetiosflags(mask) で使用されたとき、ストリーム out
または in
の mask
で指定されたすべての書式フラグをクリアします。
目次 |
[編集] 引数
mask | - | クリアするフラグのビットマスク |
[編集] 戻り値
str
が std::basic_ostream<CharT, Traits> または std::basic_istream<CharT, Traits> 型のストリームの名前である場合に式 str << resetiosflags(mask) または str >> resetiosflags(mask) が以下のコードが実行されたかのように動作するような、未規定な型のオブジェクトを返します。
str.setf(std::ios_base::fmtflags(0), mask);
[編集] 例
Run this code
#include <sstream> #include <iostream> #include <iomanip> int main() { std::istringstream in("10 010 10 010 10 010"); int n1, n2; in >> std::oct >> n1 >> n2; std::cout << "Parsing \"10 010\" with std::oct gives: " << n1 << ' ' << n2 << '\n'; in >> std::dec >> n1 >> n2; std::cout << "Parsing \"10 010\" with std::dec gives: " << n1 << ' ' << n2 << '\n'; in >> std::resetiosflags(std::ios_base::basefield) >> n1 >> n2; std::cout << "Parsing \"10 010\" with autodetect gives: " << n1 << ' ' << n2 << '\n'; }
出力:
Parsing "10 010" with std::oct gives: 8 8 Parsing "10 010" with std::dec gives: 10 10 Parsing "10 010" with autodetect gives: 10 8
[編集] 関連項目
特定の書式フラグをセットします ( std::ios_base のパブリックメンバ関数)
| |
指定された ios_base のフラグを設定します (関数) |