C++ 如何在C/C+;中以编程方式创建软链接+;?

C++ 如何在C/C+;中以编程方式创建软链接+;?,c++,c,symlink,freebsd,C++,C,Symlink,Freebsd,如何在C/C++中以编程方式创建软链接?freebsd中的link()系统调用将创建硬链接。您需要的系统调用是 #包括 int符号链接(常量字符*name1,常量字符*name2); 将创建一个符号链接name2,指向name1 您可以调用symlink() symlink函数在unistd.h中定义。谢谢,这有帮助:)谢谢,这有帮助。系统编程新手。 #include <unistd.h> int symlink(const char *name1, const char *n

如何在C/C++中以编程方式创建软链接?freebsd中的link()系统调用将创建硬链接。

您需要的系统调用是

#包括
int符号链接(常量字符*name1,常量字符*name2);
将创建一个符号链接
name2
,指向
name1

您可以调用
symlink()


symlink
函数在
unistd.h
中定义。谢谢,这有帮助:)谢谢,这有帮助。系统编程新手。
#include <unistd.h>

int symlink(const char  *name1, const char *name2);
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.