How would you get the absolute path of a file from where you're running the code? It has to be turned into string format, I want to get images from that path. Don't tell me to use the path C:\Users\BlahBlahBlah...
because not every computers path is the same and I intend to use it for a game.
Asked
Active
Viewed 2,286 times
0

XBM
- 37
- 1
- 2
- 7
-
2Isn't that's what relative paths are for? Why do you need to use absolute? Anyway, check this (assuming Win): [Path to the folder where the executable is located](http://stackoverflow.com/questions/2647429/c-windows-path-to-the-folder-where-the-executable-is-located) – sharyex Dec 01 '16 at 23:27
-
If your compiler supports the new `filesystem` Technical Specification or the coming `C++17` standard you can use: [std::filesystem::absolute](http://en.cppreference.com/w/cpp/filesystem/absolute). – Galik Dec 01 '16 at 23:40