这是我的简单程序的一部分
string appData = getenv("APPDATA");
const char *mypath= (appData+"\\MyApplication\\hello.txt").c_str();
cout << mypath;
// output: c:\users\xrobot\appdata\Roaming\Myapplication\hello.txt
fstream file(mypath,ios::in);
ofstream filetemp;
filetemp.open("world.bak");
cout << mypath;
// output: É↕7
为什么 mypath 在那个奇怪的字符串中发生了变化?