##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# std::experimental::filesystem::create_symlink,create_directory_symlink

From cppreference.com
< cpp‎ | experimental‎ | fs

Defined in header `<experimental/filesystem>` |  |
void create_symlink( const path& to, const path& new_symlink ); | (1) | (filesystem TS)
void create_symlink( const path& to, const path& new_symlink, error_code& ec ); | (2) | (filesystem TS)
void create_directory_symlink( const path& to, const path& new_symlink ); | (3) | (filesystem TS)
void create_directory_symlink( const path& to, const path& new_symlink, error_code& ec ); | (4) | (filesystem TS)

Creates a symbolic link from `new_symlink` to `to`. The (1-2) overloads should be used to create symbolic links to files whereas the (3-4) overloads should be used to create symbolic links to directories.

The (2) and (4) versions set `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 symbolic links or support symbolic links only for regular files. Some file systems do not support symbolic links at all.

### [edit] Parameters

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

### [edit] Return value

(none)

### [edit] Exceptions

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

### [edit] See also

| This section is incomplete

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=cpp/experimental/fs/create_symlink&oldid=68495"
Categories:

- unconditionally noexcept
- Todo without reason