std::experimental::filesystem::create_hard_link

From cppreference.com
< cpp‎ | experimental‎ | fs
Defined in header <experimental/filesystem>
void create_hard_link( const path& to, const path& new_link );
(1) (filesystem TS)
void create_hard_link( const path& to, const path& new_link,
                       error_code& ec );
(2) (filesystem TS)

Creates a hard link at new_link which links to a file or directory to. equivalent(to, new_link) holds after successful creation of a hard link.

The contents of to are not changed.

The second overload sets ec to an appropriate error code if an error occurs. Otherwise, ec is cleared with a call to ec.clear().

Symbolic link support depends on the operating system the program runs on and on the target file system. Some operating systems do not support hard links or support hard links only for regular files. Some file systems do not support hard links at all.

Contents

[edit] Parameters

to - path of the file to link to
new_link - path of the new symbolic link
ec - error code to store the error state to

[edit] Return value

(none)

[edit] Exceptions

1) filesystem_error if an error occurs. The exception object is constructed with to and new_link as arguments. The error code is set to an appropriate error code for the error that caused the failure.
2)
noexcept specification:  
noexcept
  

[edit] See also