Having trouble with fstream in Xcode

故事扮演 提交于 2019-12-02 03:29:15

REGISTER.txt is in the same directory as my .cpp file

REGISTER.txt needs to be in the same directory as the binary (build/Release or elsewhere depending on your build settings)

Normally it would be the directory where your program lives. If you want to make sure, use _getcwd to get the current directory or just include the parent directory.

char *_getcwd( char *buffer, int maxlen );

However, you should try not to use the full path for the reason it might not be the same when you run your program on another computer.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!