iostream和大于4GB的文件 [英] iostream and files larger than 4GB

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

问题描述




我对C ++的功能和库相对较新。我需要

访问大于4GB的文件,这是AFAIK无法使用STL

iostream - 至少在使用32位编译器时不行。 iostream是我最喜欢的,因为我的代码必须处理文件以及内存缓冲区...


有人可以帮助我一些函数/类是什么最好的这个

的情况?


BTW:我目前在Win32上使用Visual C ++ 2008,但如果可能的话我想要

将我的代码写成尽可能便携。


Robert

解决方案

Robert Kochem写道:


我对C ++的功能和库相对较新。我需要

访问大于4GB的文件,这是AFAIK无法使用STL

iostream - 至少在使用32位编译器时不行。 iostream是我最喜欢的,因为我的代码必须处理文件和内存缓冲区......



你真的尝试过但是失败了,或者只是你的推测?


有人可以帮助我这个

案例中哪些函数/类最好?


顺便说一句:我目前在Win32上使用Visual C ++ 2008,但如果可能的话,我希望

将我的代码编写为尽可能便携。



AFAIK,即使是像fread和fseek这样的标准C库函数也应该使用大文件来处理
。而且由于C ++ I / O流相对较薄,所以C流的包装器也可以很好地工作。

写一个程序,看看你是否得到它工作,如果没有,发布你的代码和

解释情况。


V

-

请在通过电子邮件回复时删除资金''A'

我没有回复最热门的回复,请不要问

< br>

Victor Bazarov schrieb:


Robert Kochem写道:


>我是C ++相对较新的关于它的功能和库。我需要访问大于4GB的文件,这是使用STL
iostream无法实现的AFAIK - 至少在使用32位编译器时是这样。 iostream是我最喜欢的,因为我的代码必须处理文件和内存缓冲区...



你真的尝试过失败了,或者是只有你的推测?



如果您收到可能的数据丢失喂食seekg()时带有

64位整数的警告 - 你会期待什么?


AFAIK,甚至标准C库函数如fread和fseek应该使用大文件来使用
。而且由于C ++ I / O流相对较薄,所以C流的包装器也可以很好地工作。

写一个程序,看看你是否得到它工作,如果没有,发布你的代码和

解释情况。



它可能适用于文件,但我可以在内存流上使用它们吗?


Robert


Robert Kochem写道:


Victor Bazarov schrieb:


> Robert Kochem写道:


>>我对C ++的功能和库相对较新。我需要访问大于4GB的文件,这是使用STL
iostream无法实现的AFAIK - 至少在使用32位编译器时是这样。 iostream是我最喜欢的,因为我的代码必须处理文件和内存缓冲区...


你真的尝试过失败了,还是仅仅是你的推测?



如果您收到可能的数据丢失使用

64位整数进行seekg()时的警告 - 你会期待什么?



我希望不要再使用seekg。或者切换到更好的实现

库。


>


> AFAIK,甚至像fread和fseek这样的标准C库函数都应该使用大文件。并且由于C ++ I / O流是相对较薄的C流包装器,所以它们也可以正常工作。
编写一个程序,看看你是否能够工作,如果没有,发布你的代码和
解释情况。



它可能适用于文件,但我可以在内存流上使用它们吗?



我不知道那是什么,对不起。


V

- -

请在通过电子邮件回复时删除资金''A'

我没有回复最热门的回复,请不要问


Hi,

I am relative new to C++ regarding it''s functions and libraries. I need to
access files larger than 4GB which is AFAIK not possible with the STL
iostream - at least not if using a 32 bit compiler. iostream was my
favorite as my code has to work on files as well as memory buffers...

Could somebody please help me what functions/classes are the best in this
case?

BTW: I am currently using Visual C++ 2008 on Win32, but if possible I want
to write my code as "portable as possible".

Robert

解决方案

Robert Kochem wrote:

I am relative new to C++ regarding it''s functions and libraries. I need to
access files larger than 4GB which is AFAIK not possible with the STL
iostream - at least not if using a 32 bit compiler. iostream was my
favorite as my code has to work on files as well as memory buffers...

Have you actually tried and failed, or is that only your speculation?

Could somebody please help me what functions/classes are the best in this
case?

BTW: I am currently using Visual C++ 2008 on Win32, but if possible I want
to write my code as "portable as possible".

AFAIK, even standard C Library functions like fread and fseek should
work with large files. And since C++ I/O streams are relatively thin
wrappers around C streams, those are expected to work just as well.
Write a program, see if you get it to work, if not, post your code and
explain the situation.

V
--
Please remove capital ''A''s when replying by e-mail
I do not respond to top-posted replies, please don''t ask


Victor Bazarov schrieb:

Robert Kochem wrote:

>I am relative new to C++ regarding it''s functions and libraries. I need to
access files larger than 4GB which is AFAIK not possible with the STL
iostream - at least not if using a 32 bit compiler. iostream was my
favorite as my code has to work on files as well as memory buffers...


Have you actually tried and failed, or is that only your speculation?

If you get a "possible loss of data" warning when feeding seekg() with an
64 bit integer - what would you expect?

AFAIK, even standard C Library functions like fread and fseek should
work with large files. And since C++ I/O streams are relatively thin
wrappers around C streams, those are expected to work just as well.
Write a program, see if you get it to work, if not, post your code and
explain the situation.

It may work for files, but can I work with them on memory streams?

Robert


Robert Kochem wrote:

Victor Bazarov schrieb:

>Robert Kochem wrote:

>>I am relative new to C++ regarding it''s functions and libraries. I need to
access files larger than 4GB which is AFAIK not possible with the STL
iostream - at least not if using a 32 bit compiler. iostream was my
favorite as my code has to work on files as well as memory buffers...

Have you actually tried and failed, or is that only your speculation?


If you get a "possible loss of data" warning when feeding seekg() with an
64 bit integer - what would you expect?

I expect not to use seekg then. Or switch to a better implementation of
the library.

>

>AFAIK, even standard C Library functions like fread and fseek should
work with large files. And since C++ I/O streams are relatively thin
wrappers around C streams, those are expected to work just as well.
Write a program, see if you get it to work, if not, post your code and
explain the situation.


It may work for files, but can I work with them on memory streams?

I don''t know what those are, sorry.

V
--
Please remove capital ''A''s when replying by e-mail
I do not respond to top-posted replies, please don''t ask


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

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