
In Xcode, when I fopen a file that doesn't exist in my computer, you can see it created in the directory you choose, but it won't show up in the contents in the left of Xcode. How can I make it show up in the Xcode once I create it?

In Xcode, when I fopen a file that doesn't exist in my computer, you can see it created in the directory you choose, but it won't show up in the contents in the left of Xcode. How can I make it show up in the Xcode once I create it?
You need to create a so-called "Folder reference" to your output folder.
Xcode has two kinds of folders in a project tree:
The difference is explained for example here: Difference between folder and group in Xcode?.
When I use C function "fopen("test.txt", "w+") create a new file "text.txt", it will appear in my directory of main.c, but it won't show up in the left content(project navigator), I mean how I see the "text.txt" appear in the content once I create it, but not add it manually? – 李梧畅 yesterday
For single files Xcode only supports "Group references" which means that a file will not appear automatically if you create it in the physical folder. So you have only two options:
Below are the steps needed to accomplish this with screenshots:
In the file system, in the folder where your main.c is located, create a folder of given name like Output.
In Xcode right-click on your folder practice_io, click "Add Files to ...".
Output directory