http://www.cplusplus.com/doc/tutorial/files/
我刚刚完成了这个,但我的桌面上没有任何文件.
那么.txt文件放在我的计算机上的哪个位置?
// basic file operations
#include
#include
using namespace std;
int main ()
{
ofstream myfile;
myfile.open ("example.txt");
myfile << "Writing this to a file.\n";
myfile.close();
return 0;
}
该死的……我看过这篇帖子从来没有多次回答过……
这是解决方案
当您在当前项目中工作时,在项目导航器中有许多文件.试试产品(如果我还记得)并查找可执行文件.现在转到属性检查器或其他任何调用. (Xcode的右侧.)
在那里你会找到一个名为PATH的部分,就是在那里写的路径.它是可执行文件运行的路径.这意味着您可以在其中找到您使用程序创建的所有文件.
尝试一下……这就是我管理和查看我的.txt文件的方式,因为有时我想给他们一些格式.
我希望我已经解决了你的问题……干杯!