-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