Chinaunix首页 | 论坛 | 博客
  • 博客访问: 432978
  • 博文数量: 138
  • 博客积分: 4114
  • 博客等级: 上校
  • 技术积分: 1341
  • 用 户 组: 普通用户
  • 注册时间: 2007-10-14 20:41
文章分类

全部博文(138)

文章存档

2014年(1)

2013年(2)

2012年(78)

2011年(13)

2010年(34)

2009年(10)

我的朋友

分类: LINUX

2009-06-16 18:40:55

in the net i found some code, about the large file.

#include
#include
#include
#include
#include
#include
int main(int argc, char **argv) {
    struct stat filestat;
    printf("file size: %lld bytes\n", fstat(argv[1], &filestat.st_size));
    return 0;
}
it is said that it supported super large file, but i don't think so.

we can find the prototype of st_size is off_t and
typedef __kernel_off_t off_t
typedef long __kernel_off_t
then we can the off_t 's true color. i think the posix should improve it .
it should be like this :
typedef long long __kernel_off_t
but gnu has improved it
in the head of the source file define the _GNU_SOURCE can turn the features on
like thie
_GNU_SOURCE
#include
#include
#include
int main(int argc, char **argv) {
     struct stat64 filestat;
     printf("file size: %lld bytes\n", fstat64(argv[1], &filestat.st_size));
     return 0;
}
gnu is more human, i think.hehe
阅读(1193) | 评论(0) | 转发(0) |
0

上一篇:cscope

下一篇:linux 图形界面编程基础

给主人留下些什么吧!~~