#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
/*
* 显示文件的大小
* 通过stat函数获得成员信息
*
*
*/
int main(){
struct stat infobuf;
if(stat("/etc/passwd",&infobuf)==-1)
perror("/etc/passwd");
else
printf("This size of /etc/passwd is %d\n",infobuf.st_size);
}
Shell命令编写——显示文件的大小filesize
最新推荐文章于 2023-06-30 14:11:22 发布