在Xcode中,当编译c++时,文件流在哪里输出文件

In Xcode, when compiling c++, where does the file stream output the file?

本文关键字:文件 在哪里 输出 编译 Xcode c++      更新时间:2023-10-16

我知道在VS2012中,第四件事保存在与source.cpp文件相同的文件夹中,但我无法使用Xcode在mac中找到该文件。让我说清楚:

    int main()
    {
    ofstream fout;
    fout.open("MyFile.txt");   
    fout << "Where am I going?";
    fout.close();
    return 0;
    }

所以如果"MyFile.txt"不存在,它被创建。

在您的家中(例如/Users/roshinichi)遵循此路径

./Library/Developer/Xcode/DerivedData/

位于应用程序的"派生数据"。你的文件在那里。一般来说,在mac上,你可以从shell

find . -name MyFile.txt

我希望这对你有帮助