📄 p4-2.c
字号:
#include <stdio.h>#include <stdlib.h>#include <sys/stat.h>#include "err_exit.h"int main(void){ int link_value; const char *path1 = "testfile1"; const char *path2 = "testfile2"; struct stat orig_buf, new_buf; printf("create testfile\n"); creat(path1, S_IRWXU|S_IRWXG|S_IRWXO); printf("get testfile1 status\n"); stat(path1, &orig_buf); printf("orig_buf.st_nlink=%d\n", orig_buf.st_nlink ); printf("create link from %s to %s\n",path1,path2); if (link(path1, path2)) err_exit("link() call failed"); printf("link() call successful\n"); stat (path1, &new_buf); printf("new_buf.st_nlink=%d\n", new_buf.st_nlink ); return(EXIT_SUCCESS);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -