New to Xcode can't open files in c++?

前端 未结 6 704
暖寄归人
暖寄归人 2020-11-30 19:26

I\'ve been using windows in a class I\'ve been taking but I am trying to run a basic code to figure out how to open/close/input/output from files on Xcode and the code I usu

6条回答
  •  悲哀的现实
    2020-11-30 20:26

    Here's a completely different approach: Have Xcode copy the input file for you.

    • Select your project in Xcode
    • Select Build Phases
    • Click the '+' button to create a new Build Phase

    Steps 1-3

    • Select New Copy Files Build Phase

    Step 4

    • Select Products Directory
    • Click the '+' button to add your file

    Steps 5-6

    • Click Add Other

    Step 7

    • Select your input file and click Open

    Step 8

    • Check the Copy items… checkbox and click Finish

    Step 9

    Now every time you build your project, the input file will be copied to the same folder as the executable no matter where it is built. Of course, to see the output file, you'll still need to find the executable in Finder.

提交回复
热议问题