-2
執行代碼後,我無法在桌面中找到新創建的文件。任何人都可以告訴創建的文件將保存在哪裏?在C++中創建文件時,創建的文件在哪裏保存?
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ofstream testfile("testing.txt");
if (testfile.is_open())
{
testfile << "This is a line.\n";
testfile << "This the second line.\n";
testfile.close();
}
else cout << "Unable to open file";
return 0;
}
***創建的文件在哪裏保存?***可能取決於你的ide。如果你不使用IDE,它可能與可執行文件相同。 – drescherjm
@StoryTeller我想他是指由ofstream創建的文件。 – pSoLT
你確實是對的。我誤解了。 – StoryTeller