How do I get the path of the current working directory in C++.
I know in python its looks this:
import os
path = os.getcwd()
I need something similar in C++ which I'm unable to find out.
How do I get the path of the current working directory in C++.
I know in python its looks this:
import os
path = os.getcwd()
I need something similar in C++ which I'm unable to find out.
It's platform dependent. If you use some frameworks like Qt, they have own tools. Python uses POSIX functions and on POSIX-compatible platform they are accessible from C++, some are available in Windows under same names, but POSIX layer there doesn't support multibyte paths. GetCurrentDirectory
is the name of Windows API function.
There is draft declared by standard: std::experimental::filesystem::current_path
http://en.cppreference.com/w/cpp/experimental/fs/current_path