从注册表接收到的宽数据被截断
wofstream being truncated at wide data received from the registry
在尝试向文件写入宽字符时,我的wofstream正在截断。
my_file << L"something";
wstring foo = //get a value from the registry ..
// foo contains 您好
my_file << foo;
my_file << "stuff that will never be seen";
在流中设置了badbit(或其他错误位),使其对之后的任何操作都无效。这可能是在实现定义行为的边界上(特别是对于wchar_t
),它只是不会按你想要的方式工作。
最大的错误概率是字符不适合一个2字节的wchar_t
,使微软的STL阻塞。
相关文章:
- 有没有任务栏API可以立即应用注册表更改
- 检查注册表项是否链接到(或副本)另一个注册表项
- 禁用地址共享注册表不起作用
- 如何从注册表项中提取配置单元和注册表名称
- 注册表正在设置 1 个字符
- 清理"QSettings"注册表项的最佳方法(Windows上的Qt 5)
- 在 c++ 中编辑注册表项
- 某些进程的注册表限制
- 在编译时生成某种子类/类型注册表?
- 如何测试注册表项是否存在?
- 注册表-获取值(而不是键)上次更改的时间和键创建日期
- 从注册表中检索已注销用户的 sid
- 如何正确检查 c++ 是否存在注册表项?
- 如何在不使用任何数据库的情况下制作动态注册表单?
- SQLite C/C++ 接口:将数据插入表时内存增加
- 访问注册表数据以设置链接器和包含路径
- 在注册表项中创建新数据
- Lua注册表与轻用户数据和引用之间的区别是什么?
- 从注册表接收到的宽数据被截断
- 如何使用 Windows API 确定注册表值数据的大小?