[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. HTTPS抓包配置

    以Charles为例 配置Charles抓取Https需要手机和PC分别进行配置. 步骤: 1.PC下载charles客户端,并安装. 2.charles客户端安装证书 注意证书安装需要保存在&quo ...

  2. BMP图片转换为JPEG图片

    原文:BMP图片转换为JPEG图片 昨天在家学习,发现很多人把BMP图片转换为其它图片格式,有些人写得简单,有些人写得复杂. Insus.NET在想,一直在做文件上传,下载,或是图片剪切,都有进行过文 ...

  3. Java 反射 想

    所谓反射.是指在执行时状态中,获取类中的属性和方法.以及调用当中的方法的一种机制. 这样的机制的作用在于获取执行时才知道的类(Class)及当中的属性(Field).方法(Method)以及调用当中的 ...

  4. HDU 2647 Reward(图论-拓扑排序)

    Reward Problem Description Dandelion's uncle is a boss of a factory. As the spring festival is comin ...

  5. 小记 js unicode 编码解析

    原文:小记 js unicode 编码解析 var str = "\\u6211\\u662Funicode\\u7F16\\u7801"; 关于这样的数据转换为中文问题,常用的两 ...

  6. Asp.Net超时问题汇总

    在数据库或者请求操作时,如果选择的时间段过短或操作数据量过大,就会遇到"请求超时"的的问题,网络上提供很多解决方案,但普遍不完善,根据个人经验及参考网络解决方案,先将其汇总如下: ...

  7. ORACLE union order by

    select * from ( select a.id,a.oacode,a.custid,a.custname,a.xsz,a.salename,a.communicationtheme,a.com ...

  8. 【Unity 3D】学习笔记三十八:角色控制器

    角色控制器 在unity中,已经帮我们实现的上下左右跳等动作,并将他们封装成了角色控制器.角色控制器保存在unity标准资源包中,能够说是很的强大.能够模拟第一或者第三人称视角.不受刚体的限制,很适用 ...

  9. Mediator - 中介者模式

    定义 用一个中介对象来封装一系列的对象的交互.中介者使各对象不须要显示地相互使用,从而使其耦合松散,并且能够独立的改变他们之间的交互. 案例 比方有一个图像界面,在界面上有一个输入框LineEdit, ...

  10. code forces 148D Bag of mice (概率DP)

    time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standa ...