std::experimental::filesystem::current_path

Header: <experimental/filesystem>

Returns or changes the current path.

# Declarations

path current_path();

(filesystem TS)

path current_path( error_code& ec );

(filesystem TS)

void current_path( const path& p );

(filesystem TS)

void current_path( const path& p, error_code& ec );

(filesystem TS)

# Parameters

# Notes

The current working directory is the directory that is used as the starting location in path resolution for relative paths. Single current working directory is associated with entire process.

The current working directory is a dangerous global state of the program. Behavior of various file input/output related functions are affected by the value of the current path. The current path may be unexpectedly changed by any component of the program, including various external libraries or other threads.