stat command to achieve

Mission requirements

Learn to use stat (1), and using C language
theme 1. Submit learning stat (1) of
2.man -k, using the grep -r
3. pseudocode
4. Product Code mystate.c, cloud code Submit link
5. test code, and MYSTAT stat (1) Comparative submit screenshot

Experimental Procedure

  • Screenshot 1. Submit learning stat (1) of
    man 1 statView
作用:获取文件信息
头文件:include <sys/types.h> #include <sys/stat.h> #include <unistd.h>
函数原型:int stat(const char *path, struct stat *buf)
返回值:成功返回0,失败返回-1;
参数:文件路径(名),struct stat 类型的结构体
  • 2.man -k, using the grep -r
    man -k stat | grep 2to find a system call

    man 2 statto see stat function
  • 3. pseudocode
调用函数stat()
打印输出节点ino、
文件类型mode、
文件的连接数nlink、
用户ID uid和组ID gid、
块大小blksize、
字节数size、
块数目blocks、
三个时间atime、mtime和ctime
  • 4. Product Code mystate.c, submit code link cloud
  • The test code, and MYSTAT stat (1) Comparative submit screenshot

Guess you like

Origin www.cnblogs.com/killer-queen/p/12105121.html