std::experimental::filesystem::create_symlink, (3) - Linux Manuals
std::experimental::filesystem::create_symlink,: std::experimental::filesystem::create_symlink,
NAME
std::experimental::filesystem::create_symlink, - std::experimental::filesystem::create_symlink,
Synopsis
Defined in header
void create_symlink(
void create_symlink(
error_code&
void create_directory_symlink(
link
void create_directory_symlink(
link, error_code&
Creates a symbolic link link with its target set to target as if by POSIX symlink():
the pathname target may be invalid or non-existing.
Some operating systems require symlink creation to identify that the link is to a
directory. Portable code should use
(1), even though there is no distinction on POSIX systems.
Parameters
target - path to point the symlink to, does not have to exist
link
ec Return value
(none)
Exceptions
The overload that does not take a error_code&
underlying OS API errors, constructed with target as the first argument, link as the
second argument, and the OS error code as the error code argument. std::bad_alloc
may be thrown if memory allocation fails. The overload taking a error_code&
parameter sets it to the OS API error code if an OS API call fails, and executes
ec.clear()
noexcept specification:
noexcept
Notes
Some operating systems do not support symbolic links at all or support them only for
regular files.
Some file systems do not support symbolic links regardless of the operating system,
for example the FAT system used on some memory cards and flash drives.
Like a hard link, a symbolic link allows a file to have multiple logical names. The
presence of a hard link guarantees the existence of a file, even after the original
name has been removed. A symbolic link provides no such assurance;
named by the target argument need not exist when the link is created. A symbolic
link can cross file system boundaries.
Example
// Run this code
if(is_symlink(it->symlink_status()))
Possible output:
See also
status
symlink_status
read_symlink
create_hard_link creates a hard link