[fs.op.canonical]

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

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

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

#### 31.12.13.3 Canonical [fs.op.canonical]

[ð](#lib:canonical)

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

[1](#1)

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

*Effects*: Converts p to an absolute
path that has no symbolic link, dot, or dot-dot elements
in its pathname in the generic format[.](#1.sentence-1)

[2](#2)

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

*Returns*: A path that refers to
the same file system object as absolute(p)[.](#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#L17236)

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

[4](#4)

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

*Remarks*: !exists(p) is an error[.](#4.sentence-1)
