将STL的字符写入硬盘,中文都是乱码?急~~~~ STL的字符操作可通过string,wstring(Unicode)我将STL的字符写入硬盘,中文都是乱码,用write和MFC的CFile都是这样,但调试状态看到,字符是正确的!急切,求解~~~~,谢谢! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 string的时候你把汉字给分开了,所有产生了乱码 //没有设个问题啊!#include "stdafx.h"#include <string>using std::string;#include <fstream>using std::fstream;int main(int argc, char* argv[]){ fstream file; file.open("c:\\a.txt", std::ios_base::out); if ( file.fail() ) return 0; file.clear(); //获取数据字符串 string strData("ad阿比"); //写到文件 file.write(strData.c_str(), (int)strData.size()); file.close(); return 0;} win7 Lotus.NotesSession 注册不成功 如何获得自开机连上网络时到现在本机总共已经接收和发送了多少个字节数? 类的成员函数里定义的局部变量 mfc 工具条添加兹定于图片 大家有没有遇到过这种问题? 如果我想在Windows安全模式下让程序自启动,有何办法? 请指点! 怎样消除text控件的右键菜单,弹出自定义菜单,不用api可以吗? 求帮忙编写一个能更改本地电脑在外网IP的程序 为什么这样DOMODAL有错???送分! 高分 求救 关于CRichEditCtrl VC++中的EDIT 控件 我把他设成了Read-Only ,,但是它的背景颜色还想是白色的 怎么设置?
using std::string;
#include <fstream>
using std::fstream;int main(int argc, char* argv[])
{
fstream file;
file.open("c:\\a.txt", std::ios_base::out);
if ( file.fail() )
return 0; file.clear();
//获取数据字符串
string strData("ad阿比");
//写到文件
file.write(strData.c_str(), (int)strData.size()); file.close(); return 0;
}