When opening a file with the filename containing the path such as "/data", I can build and run it on Windows system and command line run on Mac. but it does not work on Xcode on Mac. I must change the path to be the absolute path such as "/Users/jack/Documents/codesfile/data", it can run on Xcode. How can I solve this problem ? It has a good definition for the filename and file path for opening a new file on Xcode ??? Thanks very much!
I would not have expected "/data" to do what you want in any of those cases, as it is an absolute path. "./data" should work. I'll guess that in Xcode, the default folder is not the same as in your other environments.