I'am familiar that getcwd() function is available in c to get current working directory.Is there a std function in cpp for the same?
Asked
Active
Viewed 54 times
2 Answers
4
Yes.
C++17 has std::filesystem::current_path
.
On a POSIX system, you can also just keep using getcwd()
. getcwd()
is not actually part of C. Even it were, you could still keep using it, as the C Standard Library is available in C++; however, you've probably heard that it is preferable to use the C++ Standard Library where possible, and that's largely true.
Asteroids With Wings
- 16,164
- 2
- 17
- 33
0
Use current_path() method in boost::filesystem or std::filesystem::current_path() in c++17
Ali Razmkhah
- 245
- 1
- 8