救命 !如何获得大于2G的文件大小? [英] Help ! how to get a file size larger than 2G?

查看:70
本文介绍了救命 !如何获得大于2G的文件大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一个非常大的文件,我们可以使用stat来获取文件大小(< 2G),

struct stat buf ;

stat(" file",& buf);

long s =(long)stat.st_size;


但是stat :: st_size是off_t的类型(typedef long),

那么大于2G的文件怎么样?


非常感谢〜

there is a file which is very large,

we can use stat to get a file size(<2G),
struct stat buf;
stat("file", &buf);
long s=(long)stat.st_size;

but stat::st_size is type of off_t(typedef long),
so how about a file larger than 2G?

many thanks~

推荐答案

zou写道:
zou wrote:

有一个非常大的文件,


我们可以使用stat来获取文件大小(< 2G),

struct stat buf;

stat(" file", & buf);

long s =(long)stat.st_size;


但是stat :: st_size是off_t的类型(typedef long),

那么大于2G的文件怎么样?
there is a file which is very large,

we can use stat to get a file size(<2G),
struct stat buf;
stat("file", &buf);
long s=(long)stat.st_size;

but stat::st_size is type of off_t(typedef long),
so how about a file larger than 2G?



您必须调查您的平台提供的选项。标准C

本身没有指定获取文件大小的函数。唯一完全

便携式方法是读取文件并保持计数,即便如此,

它的大小在磁盘上。可能与通过阅读

计算的大小不同。


您似乎也在使用C ++。如果是这样,那么适当的组是

comp.lang.c ++。

You''ll have to investigate the options provided by your platform. Standard C
itself specifies no functions to get the size of a "file." The only fully
portable method is to read through the file and keep count, and even then,
it''s size "on disk" might be different to the size calculated by reading
it.

You also seem to be using C++. If so, then the appropriate group is
comp.lang.c++.


zou写道:
zou wrote:

有一个非常大的文件,我们可以使用stat来获取文件大小(< 2G),

struct stat buf;

stat(" file",& buf);

long s =(long)stat.st_size;


但是stat :: st_size是off_t的类型(typedef long),

那么大于2G的文件怎么样?
there is a file which is very large,

we can use stat to get a file size(<2G),
struct stat buf;
stat("file", &buf);
long s=(long)stat.st_size;

but stat::st_size is type of off_t(typedef long),
so how about a file larger than 2G?



你在这里和你在clc ++中一样偏离主题,试试comp.unix.programmer。


-

Ian Collins。

You are as off topic here as you were in c.l.c++, try comp.unix.programmer.

--
Ian Collins.


zou写道:
zou wrote:

>

有一个文件是非常大,我们可以使用stat来获取文件大小(< 2G),

struct stat buf;

stat(file,& buf);

long s =(long)stat。 st_size;


但是stat :: st_size是off_t的类型(typedef long),

那么大于2G的文件怎么样?
>
there is a file which is very large,

we can use stat to get a file size(<2G),
struct stat buf;
stat("file", &buf);
long s=(long)stat.st_size;

but stat::st_size is type of off_t(typedef long),
so how about a file larger than 2G?



stat和off_t不是标准C的一部分,因此在这里偏离主题。

查找处理您系统的新闻组,可能< br $> b $ b comp.unix.programmer。


-

Chuck F(cinefalconer at maineline dot net)

可用于咨询/临时嵌入式和系统。

< http://cbfalconer.home.att.net>


-

通过 http://www.teranews.com

stat and off_t are not part of standard C and thus off-topic here.
Find a newsgroup dealing with your system, possibly
comp.unix.programmer.

--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net>

--
Posted via a free Usenet account from http://www.teranews.com


这篇关于救命 !如何获得大于2G的文件大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆