[fs.op.absolute]

# 31 Input/output library [[input.output]](./#input.output)

## 31.12 File systems [[filesystems]](filesystems#fs.op.absolute)

### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.absolute)

#### 31.12.13.2 Absolute [fs.op.absolute]

[ð](#lib:absolute)

`path filesystem::absolute(const path& p);
path filesystem::absolute(const path& p, error_code& ec);
`

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17173)

*Effects*: Composes an absolute path referencing the same file system location
as p according to the operating system ([[fs.conform.os]](fs.conform.os "31.12.2.3 Operating system dependent behavior conformance"))[.](#1.sentence-1)

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17178)

*Returns*: The composed path[.](#2.sentence-1)

The signature with argument ec returns path() if an error occurs[.](#2.sentence-2)

[3](#3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17183)

[*Note [1](#note-1)*:

For the returned path, rp, rp.is_absolute() is true unless an error occurs[.](#3.sentence-1)

â *end note*]

[4](#4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17189)

*Throws*: As specified in [[fs.err.report]](fs.err.report "31.12.5 Error reporting")[.](#4.sentence-1)

[5](#5)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17193)

[*Note [2](#note-2)*:

To resolve symlinks
or perform other sanitization that can involve queries to secondary storage,
such as hard disks, consider canonical ([[fs.op.canonical]](fs.op.canonical "31.12.13.3 Canonical"))[.](#5.sentence-1)

â *end note*]

[6](#6)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17200)

[*Note [3](#note-3)*:

Implementations are strongly encouraged to not query secondary storage,
and not consider !exists(p) an error[.](#6.sentence-1)

â *end note*]

[7](#7)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iostreams.tex#L17206)

[*Example [1](#example-1)*:

For POSIX-based operating systems,absolute(p) is simply current_path()/p[.](#7.sentence-1)

For Windows-based operating systems,absolute might have the same semantics as GetFullPathNameW[.](#7.sentence-2)

â *end example*]
