Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext
link

Hard links the file to a new location on the same volume.

Description

If you wish to make a temporary file whose contents are ready appear at a location and error out if a file entry is already there, use link() and if success, unlink() on the former location. If you wish to always overwrite the destination, use atomic_relink() instead.

On Windows, the destination directory cannot have any handle opened to it with delete/rename privileges (file_flags::write) anywhere in the system. This is an operating system limitation.

Be aware that on Windows AFIO operates exclusively in the NT kernel namespace, NOT the Win32 namespace, and therefore paths you supply are converted by afio::path in NT kernel namespace paths. normalise_path() can convert an afio path back to a Filesystem TS path for you, but note that this may not be the path that was supplied originally. NT kernel namespace paths have a 32,767 character limit and an almost POSIX like lack of restrictions on naming or historical behaviour quirks, but as a result AFIO does not support DOS short names or any of the other historical Win32 filing system baggage.

Related types: path_req

Synopsis
virtual void handle::link(const path_req & req)
Parameters

Type

Concept

Name

Description

const path_req &

req

The absolute or relative (in which case precondition specifies a directory) path to create a hard link at.

Header

#include <boost/afio/v2/afio.hpp>

Race Guarantees

Operating system Race guarantees under a changing file system
FreeBSD Race free up to the containing directory for both source and target.
Linux, Windows Race free for source if handle open, else up to the containing directory. Race free up to the target directory.
OS X No guarantees.


PrevUpHomeNext