#include <unistd.h>
|
|
int
symlink (const char *name1, const char *name2); |
/*
* Detailed description : Example to create symlink to a file.
* Precondition : "Parent.txt" should exist in c: drive.
* Remarks : Symlink behaviour is exactly similar to link api.
*/
#include <unistd.h>
#include <stdio.h>
int main(void)
{
if(symlink("C:\arent.txt","C:\ink") < 0)
{
printf("simulated link creation to parent file failed\n");
return -1 ;
}
printf("simulated link to parent file created");
return 0 ;
}
Output
simulated link to parent file created.
| [ENOENT] | |
| A component of either path prefix does not exist. | |
| [ENAMETOOLONG] | |
| A component or an entire path name exceeded 255 characters. | |
| [ENOENT] | |
| A relative path was encountered in translating name2 and is not supported by the platform. | |
| [EINVAL] | |
| A relative path was encountered in translating name1 and is not supported by the platform. | |
| [ENOENT] | |
| An empty path was encountered in translating one of the pathnames. | |
| [ELOOP] | |
| Too many symbolic links were encountered in translating one of the pathnames. | |
| [ELOOP] | |
| name2 itself is a link type file. | |
| [ENOENT] | |
| The file named by name1 does not exist. | |
| [EEXIST] | |
| The link named by name2 does exist. | |
|
© 2005-2007 Nokia |