linux之stat函数解析
2013-08-02 22:09
239 查看
[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 socket 编程中主要函数解析
- Linux 字符设备驱动开发基础(五)—— ioremap() 函数解析
- linux之getcwd函数解析
- stat函数详解——Linux
- 【Linux的高级应用编程】TCP/IP网络编程函数解析
- Linux中用stat命令查看文件时3个时间点解析
- linux stat函数讲解
- 解析linux 文件和目录操作的相关函数
- Linux中__init、__devinit等初始化宏解析和入口函数
- linux下使用stat函数不可以取得超过2G的大文件的解决方法
- linux 中 stat () 函数讲解
- Linux下的地址解析函数(res_*)的应用实例
- Intel平台下linux中ELF文件动态链接的加载、解析及实例分析(二): 函数解析与卸载
- Linux系统中C语言编程创建函数fork()执行解析
- linux中stat()函数与st_mode用法
- 全面解析Linux 内核 3.10.x - 内核入口函数__kernel_entry
- Linux atexit函数解析
- 解析linux 文件和目录操作的相关函数
- Linux stat函数讲解(获取文件详细信息)