且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

新的Xcode不能打开c ++中的文件?

更新时间:2023-11-10 13:41:22

将.txt文件放在main.cpp文件所在的目录(或任何你喜欢的目录)中。

Put your .txt files in the same directory where your main.cpp file is (or anywhere you like).

在Xcode中转到产品>方案>编辑方案>运行测试(右侧)>选项(中间顶部)

In Xcode go to Product > Scheme > Edit Scheme > Run test (on the right) > Options (middle top)

在选项检查使用自定义工作目录下,将其设置为.txt文件所在的目录。

Down under Options check "Use custom working directory" and set it to the directory where you .txt files are located.

要使用文件将必须只指定文件名,例如in_file.open(inputFile.txt);没有路径是必要的。

To work with the files, you will have to specify just file names, e.g. in_file.open("inputFile.txt"); no path is necessary.