[fs.op.create.hard.lk]

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

## 31.12 File systems [[filesystems]](filesystems#fs.op.create.hard.lk)

### 31.12.13 Filesystem operation functions [[fs.op.funcs]](fs.op.funcs#fs.op.create.hard.lk)

#### 31.12.13.10 Create hard link [fs.op.create.hard.lk]

[ð](#lib:create_hard_link)

`void filesystem::create_hard_link(const path& to, const path& new_hard_link);
void filesystem::create_hard_link(const path& to, const path& new_hard_link,
                                      error_code& ec) noexcept;
`

[1](#1)

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

*Effects*: Establishes the postcondition, as if by POSIX link[.](#1.sentence-1)

[2](#2)

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

*Postconditions*: 

- [(2.1)](#2.1)

exists(to) && exists(new_hard_link) && equivalent(to, new_hard_link)

- [(2.2)](#2.2)

The contents of the file or directory to resolves to are unchanged[.](#2.sentence-1)

[3](#3)

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

*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#L17693)

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

Some operating systems do not support hard links at all or support
 them only for regular files[.](#4.sentence-1)

Some file systems (such as the FAT file system)
 do not support hard links regardless of the operating system[.](#4.sentence-2)

Some file systems limit the number of links per file[.](#4.sentence-3)

â *end note*]
