【发布时间】:2010-02-12 22:16:01
【问题描述】:
您好,我的程序将一些设置(主要是字符串)保存到一个文本文件中,以便稍后检索它们,但是唉!特殊字符回来无法识别!
saveSettings 将字符串一一保存...
void email::saveSettings(string filename){
ofstream savefile(filename.c_str(),ios::out | ios::trunc);
email settingsemail(this);
savefile <<mailprog<<endl;
...
loadSettings 检索它们...
bool loadSettings(string filename){
char chtemp[255];
ifstream savefile(filename.c_str(), ios::in);
if (savefile.is_open()){
savefile.getline(chtemp,255);
mailprog=chtemp;
savefile.getline(chtemp,255);
smtp=chtemp;
...
一些文本包含字母“é”,读回为“8”
感谢您的任何提示
【问题讨论】:
标签: c++ special-characters ifstream ofstream