Create a symbolic link to a path
#include <unistd.h> int symlink( const char* pname, const char* slink );
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The symlink() function creates a symbolic link named slink that contains the pathname specified by pname (slink is the name of the symbolic link created, pname is the pathname contained in the symbolic link).
File access checking isn't performed on the file named by pname, and the file need not exist.
If the symlink() function is unsuccessful, any file named by slink is unaffected.
/* * create a symbolic link to "/usr/nto/include" */ #include <stdio.h> #include <stdlib.h> #include <unistd.h> int main( void ) { if( symlink( "/usr/nto/include", "slink" ) == -1) { perror( "slink -> /usr/nto/include" ); exit( EXIT_FAILURE ); } exit( EXIT_SUCCESS ); }
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | Yes |
Thread | Yes |
errno, link(), lstat(), pathmgr_symlink(), pathmgr_unlink(), readlink(), unlink()