首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

std::resetiosflags

Defined in header <iomanip>

?

?

/*unspecified*/ resetiosflags( std::ios_base::fmtflags mask );

?

?

在表达式中使用时out << resetiosflags(mask)in >> resetiosflags(mask),清除流的所有格式标志。outinmask...

参数

mask

-

bitmask of the flags to clear

返回值

返回未指定类型的对象,以便在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);

二次

代码语言:javascript
复制
#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';
}

二次

产出:

二次

代码语言:javascript
复制
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

二次

另见

setf

sets specific format flag (public member function of std::ios_base)

setiosflags

sets the specified ios_base flags (function)

代码语言:txt
复制
 ? cppreference.com

在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com