UNIX系统编程小结(二)(3)

17.All the information in the i-node is stored separately from the actual contents of the file.

   18.A directory is simply a file containing directory entries:filenames and associated i-node numbers.

   19.

typedef的一个用法: 

typedef int Func(int a,int b);  //这声明了一个新的函数类型,Func,这种函数类型有两个int类型的参数,返回值也是int类型

static Func  my_func1;  //my_func1的函数原型,完整的写法是static int my_func1(int a ,int b); 
在这里使用typedef,会使得代码更加简洁,清晰,对代码的可读性有好处

 

   20.

char *p;  *p++='0';  是将*p赋值为'0'后,p指针再加1个单位的地址

                *++p='0';  是先将p执行加一个单位的地址后,再将*p赋值为'0'; 
这是一个比较容易混淆和容易记错的地方

 

   21.char *ptr; ptr[-1]是指是的ptr指向位置的上一个元素。

   22.The current working directory is an attribute of a process .

   23. If we try,using either open or creat,to create a file that alredy exists,the file's access permission bits are not changed but the files were truncated(被清空).

   24.The size of a directory should never be 0,since there should always be entries for dot and dot-dot.The size of a symbolic link is the number of characters in the pathname contained in the symbolic link,and this pathname must always contain at least one character.

   25.time ./pro1 计算整个pro1程序执行的时间

   26.The kernel has no inherent limit on the depth of a directory tree.But many commands will fail on pathnames that exceed PATH_MAX,比如getcwd.

  参考资料:apue

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/08fe7282040ac2c591b8c21cceaab22c.html