[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]$

linux之stat函数解析的更多相关文章

  1. Linux exec族函数解析

    背景 在提到 vfork 函数时,我们提到了这个概念.为了更好地学习与运用,我们对exec族函数进行展开. exec函数族 介绍 有时我们希望子进程去执行另外的程序,exec函数族就提供了一个在进程中 ...

  2. linux之unlink函数解析

    [lingyun@localhost unlink]$ cat unlink.c  /********************************************************* ...

  3. linux之access函数解析

    [lingyun@localhost access_1]$ ls access.c 实例一: [lingyun@localhost access_1]$ cat access.c  /******** ...

  4. linux之ioctl函数解析

    [lingyun@localhost ioctl_1]$ ls ipconfig.c [lingyun@localhost ioctl_1]$ cat ipconfig.c  /*********** ...

  5. linux之umask函数解析

    [lingyun@localhost umask_1]$ vim umask.c  + umask.c                                                 ...

  6. linux之utime函数解析

    [lingyun@localhost utime]$ ls hello  utime.c  world [lingyun@localhost utime]$ cat utime.c  /******* ...

  7. linux之chdir函数解析

    [lingyun@localhost chdir]$ ls chdir.c [lingyun@localhost chdir]$ cat chdir.c  /********************* ...

  8. linux之getcwd函数解析

    [lingyun@localhost getcwd]$ cat getcwd.c /********************************************************** ...

  9. 关于Linux系统basename函数缺陷的思考

    某模块作为前台进程独立运行时,运行命令携带命令行参数:作为某平台下守护进程子进程运行时,需要将命令行参数固化在代码里.类似如下写法: char *argv[] = {"./DslDriver ...

随机推荐

  1. 微信消息体签名及加解密功能详细解析以及.net实现

    原文:微信消息体签名及加解密功能详细解析以及.net实现 前言 微信消息体签名及加密功能已上线,明文传输确实存在安全风险,鉴于微信的用户范围使用之广泛,必定会成为众矢之的.所以大家还是尽快接入安全模式 ...

  2. JavaEE(5) - JMS实现企业Pub-Sub消息处理

    1. 在Weblogic服务器上配置Pub-Sub消息目的 向已有的JMS模块中添加消息主题: Services-->Messaging-->JMS Modules--><Mo ...

  3. Swift——(两)Swift访问元组

    在Swift在,获取元组的值到一个位置,通过三种方法: 1.使用元组变量/常量     @Author: twlkyao转载或者引用请保留此行. let http404Error = (404, &q ...

  4. C# 实现对接电信交费易自动缴费 续(winio/winring0 自动填密码)

    原文:C# 实现对接电信交费易自动缴费 续(winio/winring0 自动填密码) 自动填密码大家可能都不莫生,最有名的应该是 按键精灵 只要是一个可以输入的地方都可以能过按键精灵来完成输入.我今 ...

  5. C#记录日志、获取枚举值 等通用函数列表

    )             {                 ] >=  && ipvals[] <=                  && ipval ...

  6. 每日算法37:Rotate Image (图像旋转)

    You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockwise). ...

  7. Android_开发人员经常使用的颜色

    Android开发中经常要用一些个性化的颜色,然而茫茫的RBG颜色对比表,往往给人眼花缭乱的感觉,更别说从中轻易选出一两种比較惬意的颜色,以下我就总结一下开发中经常使用到的比較绚丽的颜色. 以下是经常 ...

  8. mysql 千分位 Format

    原文:mysql 千分位 Format select Format(123456789) 结果:123,456,789

  9. Hadoop与HBase中遇到的问题(续)java.io.IOException: Non-increasing Bloom keys异常

    在使用Bulkload向HBase导入数据中, 自己编写Map与使用KeyValueSortReducer生成HFile时, 出现了以下的异常: java.io.IOException: Non-in ...

  10. 08. 删除重复&海量数据

    原文:08. 删除重复&海量数据 重复数据,通常有两种:一是完全重复的记录,也就是所有字段的值都一样:二是部分字段值重复的记录. 一. 删除完全重复的记录完全重复的数据,通常是由于没有设置主键 ...