VMS Help  —  CRTL  link
    Creates a new link (directory entry) for an existing file. This
    function is supported only on volumes that have hard link counts
    enabled.

    Format

      #include  <unistd.h>

      link  (const char *path1, const char *path2);

1  –  Arguments

 path1

    Pointer to a pathname naming an existing file.

 path2

    Pointer to a pathname naming the new directory entry to be
    created.

2  –  Description

    The link function atomically creates a new link for the existing
    file, and the link count of the file is incremented by one.

    The link function can be used on directory files.

    If link fails, no link is created and the link count of the file
    remains unchanged.

3  –  Return Values

    0                  Successful completion.
    -1                 Indicates an error. The function sets errno to
                       one of the following values:

                       o  EEXIST - The link named by path2 exists.

                       o  EFTYPE - Wildcards appear in either path1
                          or path2.

                       o  EINVAL - One or both arguments specify a
                          syntactically invalid pathname.

                       o  ENAMETOOLONG - The length of path1 or path2
                          exceeds PATH_MAX, or a pathname component
                          is longer than NAME_MAX.

                       o  EXDEV - The link named by path2 and
                          the filenamed by path1 are on different
                          devices.
Close Help