zoukankan      html  css  js  c++  java
  • linux之stat函数解析

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

  • 相关阅读:
    Cesium视角
    Cesium删除特定的实体
    cesium之CLAMPED
    JavaScript:使用setAttribute()改变网页中标签的onclick属性
    atoi()函数及其实现
    寻找数组中的第二大数
    字符串函数之strcpy
    互换两个变量(不使用中间变量)
    寻找兄弟单词(2012.5.6百度实习)
    大数据量的存储分表常见算法(转)
  • 原文地址:https://www.cnblogs.com/jiangu66/p/3233699.html
Copyright © 2011-2022 走看看