Relative path with fstream c++
问题 I try to load a file with fstream. The code looks like this file.open("../levels/level0.lvl"); if (file.is_open()) { while (!file.eof()) { std::getline(file, Str); list = ReadLine(Str, list); } } But it loads nothing. Yes only if the path is absolute. How can I make the path relative? The folder "levels" is hosted in the debug folder. same folder as the exe. 回答1: "The folder "levels" is hosted in the debug folder. same folder as the exe." It doesn't matter in which position the levels folder