获取二进制文件的文件大小 [英] Getting file size of binary file

查看:424
本文介绍了获取二进制文件的文件大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用fseek和ftell是一个可靠的方法来获取

二进制文件的文件大小?我以为我记得在某个地方读过它不是......如果没有那么

将是正确的和便携法获得它?谢谢。

Is using fseek and ftell a reliable method of getting the file size on a
binary file? I thought I remember reading somewhere it wasn''t... If not what
would be the "right" and portable method to obtain it? Thanks.

推荐答案

" Arnold" < AR **** @ nothpole.com>写道:
"Arnold" <ar****@nothpole.com> wrote:
使用fseek和ftell一个可靠的方法来获取文件大小的文件?


编号从7.19.9.2#3:二进制流不需要有意义地支持

fseek呼叫,其值为SEEK_END"。 />

要说这让我感到有些轻描淡写。

我以为我记得在某个地方读书它不是......如果不是什么
将是正确的和便携式方法获得它?
Is using fseek and ftell a reliable method of getting the file size on a
binary file?
No. From 7.19.9.2#3: "A binary stream need not meaningfully support
fseek calls with a whence value of SEEK_END".

To say that this irks me would be a bit of an understatement.
I thought I remember reading somewhere it wasn''t... If not what
would be the "right" and portable method to obtain it?




没有,在ISO C中。


要说_this_烦我也有点轻描淡写。

至少应该可以得到操作系统认为

文件大小的值,但是显然有原因不是;不过,我已经听说过没有听说过的人了。


Richard



There is none, in ISO C.

To say that _this_ irks me would be a bit of an understatement, as well.
It should at least be possible to get the value of "what the OS thinks
the file size is", but apparently there are reasons why it isn''t; I''ve
never heard one that is convincing, though.

Richard


On 2004年1月8日星期四08:46:35 +0000,Arnold写道:
On Thu, 08 Jan 2004 08:46:35 +0000, Arnold wrote:
使用fseek和ftell是一个可靠的方法来获取文件大小的文件吗?我以为我记得在某个地方读过它不是......如果没有那么什么
将是正确的和便携法获得它?谢谢。
Is using fseek and ftell a reliable method of getting the file size on a
binary file? I thought I remember reading somewhere it wasn''t... If not what
would be the "right" and portable method to obtain it? Thanks.




尝试fstat()



try fstat()


Richard Head< rh *** @ comcast.net>潦草地写道:
Richard Head <rh***@comcast.net> scribbled the following:
2004年1月8日星期四08:46:35 +0000,Arnold写道:
On Thu, 08 Jan 2004 08:46:35 +0000, Arnold wrote:
使用fseek和ftell获取文件大小的可靠方法在
二进制文件?我以为我记得在某个地方读过它不是......如果没有那么什么
将是正确的和便携法获得它?谢谢。
Is using fseek and ftell a reliable method of getting the file size on a
binary file? I thought I remember reading somewhere it wasn''t... If not what
would be the "right" and portable method to obtain it? Thanks.


尝试fstat()

try fstat()




ISO C标准的哪一部分定义了fstat()?


-

/ - Joona Palaste(pa*****@cc.helsinki.fi)-------------芬兰--- ----- \

\ - http: //www.helsinki.fi/~palaste ---------------------规则! -------- /

我绝对的方面可能是......

- Mato Valtonen



Which part of the ISO C standard defines fstat()?

--
/-- Joona Palaste (pa*****@cc.helsinki.fi) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"My absolute aspect is probably..."
- Mato Valtonen


这篇关于获取二进制文件的文件大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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