FOPEN的最大文件大小 [英] maximum file size of FOPEN

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

问题描述

我试图在计算机中打开一些大文件。 (ram 512MB)


1.文件大小是否有限制FOPEN?


2.如果我的文件大于最大尺寸,我怎么能打开文件?

I tried to open some large files in my computer. (ram 512MB)

1. is there limitation of file size FOPEN?

2. if I have a file that is larger than the maximum size, how can I
open the file?

推荐答案

文章< 11 ** ********************@z14g2000cwz.googlegroups .com> ;,

uremae< ur **** @ gmail.com>写道:
In article <11**********************@z14g2000cwz.googlegroups .com>,
uremae <ur****@gmail.com> wrote:
我试图在我的电脑中打开一些大文件。 (ram 512MB)
1.文件大小FOPEN有限制吗?


不,除非有不寻常和系统特定的东西。


例如,可能会出现问题

打开设备或伪设备,如果设备驱动程序因某些原因决定需要将快照拍到内存中

(例如,打开/ dev / core可能会获取内核状态的快照,)

任何此类行为都将超出C的范围:对于普通文件,不会发生这种行为。


2.如果我的文件大于最大尺寸,我该如何打开文件?
I tried to open some large files in my computer. (ram 512MB) 1. is there limitation of file size FOPEN?
No, not unless there is something unusual and system-specific.

There could, for example, -potentially- be issues with
opening a device or pseudo-device, if the device driver for some
reason decided it needed to take a snapshot into memory
(e.g., opening /dev/core might take a snapshot of kernel state,)
Any such behaviour would be outside the bounds of C: such
behaviour does not happen for plain files.

2. if I have a file that is larger than the maximum size, how can I
open the file?




任何此类问题都是系统特定的。 fopen()就是C本身提供的所有内容。


*打开*现有的大文件通常不是问题:

问题通常在*读*大文件。有些系统

只能读取大约2 GB的标记,或者是否允许无限期读取
但无法定位(ftell / fseek)

超过2千兆字节而不使用系统特定的电话。

-

切勿在雷雨期间安装电话线。 - Linksys



Any such matter would be system specific. fopen() is all that
C itself provides.

It isn''t usually a problem to *open* an existing large file: the
problem is usually in *reading* the large file. Some systems
are only able to read to about the 2 gigabyte mark, or are
allowed to read indefinitely but cannot position (ftell/fseek)
beyond 2 gigabytes without using system-specific calls.
--
"Never install telephone wiring during a lightning storm." -- Linksys




" uremae" <乌尔**** @ gmail.com>写了

"uremae" <ur****@gmail.com> wrote

1.文件大小是否有限制FOPEN?

2.如果我的文件大于最大大小,我怎么能
打开文件?

1. is there limitation of file size FOPEN?

2. if I have a file that is larger than the maximum size, how can I
open the file?



虽然可能有一些限制,但是没有超过它的机会。

如果fopen()无法打开一个巨大的文件,或者读取函数不允许你读取所有内容,那么最好的解决办法是寻找更低的特定级别系统

来电。有时你可能会重新设计你的文件,以便它们在限制范围内下降。


但是要确保文件的大小确实是问题,不是那个

磁盘驱动器存在一些硬件问题,或者文件以某种方式损坏了


There''s ususally some limit, though it might be so large that there is no
chance of exceeding it.
If fopen() fails to open a huge file, or the read functions won''t allow you
to read it all, the best solution is to look for lower-level system specific
calls. Sometimes you might be able to redesign your files so that they fall
within the limit.

However make sure that the size of the file really is the problem, not that
there is some hardware problem with the disk drive, or that the file is
corrupt in some way.

在文章< d6 ********** @ nwrdmz02.dmz.ncs.ea.ibs-infra.bt.com>,

Malcolm< re * ******@btinternet.com>写道:
In article <d6**********@nwrdmz02.dmz.ncs.ea.ibs-infra.bt.com>,
Malcolm <re*******@btinternet.com> wrote:
" uremae" <乌尔**** @ gmail.com>写了
"uremae" <ur****@gmail.com> wrote
1.文件大小是否有限制FOPEN?
1. is there limitation of file size FOPEN?



有''通常有一些限制,虽然它可能太大,以至于没有机会超过它。


There''s ususally some limit, though it might be so large that there is no
chance of exceeding it.




你能给我们一个系统的例子吗?这样的限制,Malcolm?

我当然遇到了文件大小有限的系统

(对不同的文件系统类型有不同的限制),但我是/>
无法想到C或POSIX.1中的任何内容或任何实现

我已经 - 已经founn()打开一个

[一旦文件进入

文件系统就读取文件。


能够读取所有大文件是有问题的,但是:

内部文件位置计数器可能溢出(例如,如果一个

是NFS或SMB'对文件内容的驻留

a rem支持比本地

系统更大的文件的文件系统。)


在大文件中定位/重新定位的能力非常好

有问题,因为fseek()仅限于为'

抵消支付''长'...

-

注意上面代码中的错误;我只是证明它是正确的,

没试过。 - 唐纳德克努特



Could you give us an example of a system with such a limit, Malcolm ?

I have certainly run into systems whose filesize was limited
(with different limits for different filesystem types), but I
cannot think of anything in C or POSIX.1 or any implementation
that I have -encountered- that would fopen() for opening a
[plain] file for read once the file had made it on to the
filesystem.

Ability to read all of a large file is questionable, though:
the internal file position counter can overflow (e.g., if one
is NFS or SMB''ing over the contents of a file which resides on
a remote filesystem that supports much larger files than the local
system expects.)

And ability to position/ reposition in a large file is quite
questionable seeing as fseek() is limited to taking a ''long'' for the
offset...
--
Beware of bugs in the above code; I have only proved it correct,
not tried it. -- Donald Knuth


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

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