Freigeben über


create_hard_link Function

Creates a hard link to an existing file.

template<class Path1, class Path2>
inline void create_hard_link(
   const Path1& Pval1,
   const Path2& Pval2
);
template<class Path1, class Path2>
inline error_code create_hard_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 is derived from basic_path.

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

  • Code
    An error_code object.

Return Value

The second function returns Code.

Remarks

A hard link is the file system representation of a file by which more than one path references a file in the same volume.

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

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

Requirements

Header: filesystem

Namespace: std::tr2::sys

See Also

Reference

<filesystem>

Other Resources

C++ Standard Library Header Files