
私は MacBook Air で Visual Studio を並列実行しています。初めて C++ を使用して txt ファイルを開きましたが、デバッグ時にのみ機能し、デバッグなしで実行すると機能しないようです。
サンプルコード:
ofstream outfile;
outfile.open("Subscription.txt");
if (outfile.is_open())
{
outfile << name << "\n";
outfile.close();
cout << "Welcome to the discount club!" << endl;
}
else
cout << "file won't open" << endl;
ローカルデバッガーで実行すると「Welcome to..」と出力され、デバッグなしで実行すると「file won't open」と出力されます。
おそらく、Mac/Parallels の問題でしょうか?