std::locale设置不当导致异常std::bad_cast

论坛 期权论坛 脚本     
匿名技术用户   2021-1-4 12:39   18   0

std::locale 区域一般和变量类型,输出方式有关

查看和修改locale可以通过如下方式:

std::locale loc(std::locale(), new std::ctype<char>);
std::locale::global( std::locale("") );

std::cout << "The default locale is " << std::locale().name() << '\n'
          << "The user's locale is " << std::locale("").name() << '\n'
          << "A nameless locale is " << loc.name() << '\n';

有的设置不当 会导致程序跑出异常:std::bad_cast

分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:7942463
帖子:1588486
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP