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
阅读(1228) | 评论(0) | 转发(0) |