create_symlink Function

Creates a symbolic link to an existing file.

template<class Path1, class Path2>
inline void create_sym_link(
   const Path1& Pval1,
   const Path2& Pval2
);
template<class Path1, class Path2>
inline error_code create_sym_link(
   const Path1& Pval1,
   const Path2& Pval2,
   error_code& Code
);

Parameters

  • Pval1
    A Path object that represents the file name of an existing file. Path can be either a basic_path or a type that's derived from basic_path.

  • Pval2
    A Path object that contains the file name of the symbolic link.

  • Code
    An error_code object.

Return Value

The second function returns Code.

Remarks

A symbolic link is a file system object that points to another file system object.

If the symbolic link cannot be created, the first function throws a basic_filesystem_error.

The second function assigns to Code any error code that's associated with the operation.

Requirements

Header: filesystem

Namespace: std::tr2::sys

See Also

Reference

<filesystem>

Other Resources

C++ Standard Library Header Files