移除tempfile的硬链接
1 #include <sys/types.h>
2 #include <sys/stat.h>
3 #include <unistd.h>
4
5 int main(int argc,char **argv)
6 {
7 char symname[]={"mysym"};
8 char buf[80];
9
10 if (argc<2)
11 return 0;
12
13 if (symlink(argv,symname)==-1)
14 {
15 printf("symlink error!\n");
16 exit(1);
17 }
18
19 if (!readlink(symname,buf,sizeof(buf)))
20 {
21 printf("readlink error!\n");
22 exit(1);
23 }
24 printf("name of symbol link: %s.\n",buf);
25
26 exit(0);
27 }