##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# std::experimental::filesystem::current_path

From cppreference.com
< cpp‎ | experimental‎ | fs

Defined in header `<experimental/filesystem>` |  |
path current_path(); | (1) | (filesystem TS)
path current_path( error_code& ec ); | (2) | (filesystem TS)
void current_path( const path& p ); | (3) | (filesystem TS)
void current_path( const path& p, error_code& ec ); | (4) | (filesystem TS)

Returns or changes the current path.

1-2) Returns the absolute path of the current working directory. (2) returns path() if error occurs.
3-4) Changes the current working directory to `p`.

### [edit] Parameters

p | - | path to change the current working directory to
ec | - | error code to set in case of errors

### [edit] Return value

1-2) Returns the current working directory.
3-4) (none)

### [edit] Exceptions

1)

| This section is incomplete

2)
`noexcept` specification:
noexcept
3)

| This section is incomplete

4)
`noexcept` specification:
noexcept

### [edit] 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.

### [edit] See also

| This section is incomplete

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=cpp/experimental/fs/current_path&oldid=68497"
Categories:

- Todo without reason
- unconditionally noexcept