Как создать программную ссылку на c/C++?

Как создать программную ссылку программно на c / C++? link () системный вызов во freebsd создаст жесткую ссылку.

2 ответов


системный вызов, который вы хотите, это симлинк(2).

#include <unistd.h>

int symlink(const char  *name1, const char *name2);

символическая ссылка name2 создана name1


можно назвать symlink()

int  symlink(const char *name1, const char *name2);

A symbolic  link name2 is created to name1 (name2 is the name of the file
created, name1 is the string used in creating the symbolic  link).  Either
name may be an arbitrary path name; the files need  not be on the same
file system.