Xcode在哪里创建.txt文件?

Jos*_*ith 3 c++ location file

http://www.cplusplus.com/doc/tutorial/files/

我刚刚完成了这个,但我的桌面上没有任何文件.

那么.txt文件放在我的计算机上的哪个位置?

// basic file operations
#include <iostream>
#include <fstream>
using namespace std;

int main ()
{
    ofstream myfile;
    myfile.open ("example.txt");
    myfile << "Writing this to a file.\n";
    myfile.close();
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

小智 10

该死的......我看过这篇帖子从来没有多次回答过......

这是解决方案

当您在当前项目中工作时,在项目导航器中有许多文件.试试产品(如果我还记得)并查找可执行文件.现在转到属性检查器或其他任何调用.(Xcode的右侧.)

你会在那里找到一个叫做PATH路径的部分.它是可执行文件运行的路径.这意味着您可以在其中找到您使用程序创建的所有文件.

尝试一下......这就是我管理和查看.txt文件的方式,因为有时我想给他们一些格式.

我希望我已经解决了你的问题......干杯!;)


Tyl*_*ler 5

单击左侧"产品"选项卡中的可执行文件,您应该看到实用程序部分右侧显示的路径.这是他们被保存的地方.在我的计算机上,这条路径是:

/Users/myName/Library/Developer/Xcode/DerivedData/CurrentXcodeProject-adsnvetbleazktcgitfymfcbhkkt/Build/Products/Debug/filename.txt