Open method opens files with full path only C++
问题 File opens if I write the full path (full-path/roots.txt). File fails to open if I write the filename only (roots.txt) And yet, roots.txt is in the same folder as the main.cpp. Is there any settings I should check on XCode? Here's the code: string line; ifstream infile; infile.clear(); // infile.open("roots.txt"); infile.open("/Users/programming/C++/roots/roots.txt"); if (infile.fail()) cout << "could not open the file: " << strerror(errno); getline(infile, line); cout << line; 回答1: If it