linux之stat函数解析
2013-08-02 12:19
330 查看
[lingyun@localhost stat_1]$ vim stat.c
+ stat.c
/*********************************************************************************
* Copyright: (C) 2013 fulinux<fulinux@sina.com>
* All rights reserved.
*
* Filename: stat.c
* Description: This file
*
* Version: 1.0.0(08/02/2013~)
* Author: fulinux <fulinux@sina.com>
* ChangeLog: 1, Release initial version on "08/02/2013 12:15:08 PM"
*
********************************************************************************/
#include <sys/stat.h>
#include <unistd.h>
#include <stdio.h>
int main(void)
{
struct stat buf;
stat("/etc/hosts", &buf);
printf("/etc/hosts file size = %d\n", buf.st_size);
}
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~/apue/stat/stat_1/stat.c[+] CWD: /usr/local/src/lingyun/apue/stat/stat_1 Line: 22/23:55
"stat.c" [New] 23L, 714C written
[lingyun@localhost stat_1]$ ls
stat.c
[lingyun@localhost stat_1]$ gcc stat.c
[lingyun@localhost stat_1]$ ./a.out
/etc/hosts file size = 83
[lingyun@localhost stat_1]$
+ stat.c
/*********************************************************************************
* Copyright: (C) 2013 fulinux<fulinux@sina.com>
* All rights reserved.
*
* Filename: stat.c
* Description: This file
*
* Version: 1.0.0(08/02/2013~)
* Author: fulinux <fulinux@sina.com>
* ChangeLog: 1, Release initial version on "08/02/2013 12:15:08 PM"
*
********************************************************************************/
#include <sys/stat.h>
#include <unistd.h>
#include <stdio.h>
int main(void)
{
struct stat buf;
stat("/etc/hosts", &buf);
printf("/etc/hosts file size = %d\n", buf.st_size);
}
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~/apue/stat/stat_1/stat.c[+] CWD: /usr/local/src/lingyun/apue/stat/stat_1 Line: 22/23:55
"stat.c" [New] 23L, 714C written
[lingyun@localhost stat_1]$ ls
stat.c
[lingyun@localhost stat_1]$ gcc stat.c
[lingyun@localhost stat_1]$ ./a.out
/etc/hosts file size = 83
[lingyun@localhost stat_1]$
相关文章推荐
- linux之stat函数解析
- Linux中用stat命令查看文件时3个时间点解析
- linux下stat详解--相关函数
- Intel平台下linux中 ELF文件动态链接的加载、解析及实例分析(二): 函数解析与卸载
- Linux下C编程,子进程创建函数fork() 执行解析
- linux kernel set_bit() 函数解析
- Linux 多线程函数解析
- linux-011文件系统超级块的操作函数(挂载卸载系统)解析
- Linux 多线程函数解析
- Linux进程学习(五)之函数waitpid函数的解析
- Linux网络编程[DNS解析原理,了解相关DNS解析的函数]
- Linux 函数--fstat/stat/lstat系统调用
- Linux 文件操作函数 opendir()、readdir()、closedir()、stat()
- linux之dup和dup2函数解析
- Linux 多线程函数解析
- Linux stat函数讲解
- Linux系统调用之sysinfo函数解析
- linux C main()函数参数解析
- Linux---stat函数以及自己实现stat
- 二十五 Linux stat函数讲解: