A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://en.cppreference.com/w/cpp/algorithm/../ranges/../symbol_index/../filesystem/absolute.html below:

std::filesystem::absolute - cppreference.com

Returns a path referencing the same file system location as p, for which filesystem::path::is_absolute() is true.

2) This non-throwing overload returns default-constructed path if an error occurs.

[edit] Parameters p - path to convert to absolute form ec - out-parameter for error reporting in the non-throwing overload [edit] Return value

Returns an absolute (although not necessarily canonical) pathname referencing the same file as p.

[edit] Exceptions

Any overload not marked noexcept may throw std::bad_alloc if memory allocation fails.

1)

Throws

std::filesystem::filesystem_error

on underlying OS API errors, constructed with

p

as the first path argument and the OS error code as the error code argument.

2)

Sets a

std::error_code&

parameter to the OS API error code if an OS API call fails, and executes

ec.clear()

if no errors occur.

[edit] Notes

Implementations are encouraged to not consider p not existing to be an error.

For POSIX-based operating systems, std::filesystem::absolute(p) is equivalent to std::filesystem::current_path() / p except for when p is the empty path.

For Windows, std::filesystem::absolute may be implemented as a call to GetFullPathNameW.

[edit] Example

Possible output:

Current path is "/tmp/1666297965.0051296"
Absolute path for "foo.c" is "/tmp/1666297965.0051296/foo.c"
[edit] See also

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4