iostream和大文件支持 [英] iostream and large file support
问题描述
我正在开发一个使用GCC的C ++应用程式Linux上的4.x(32位操作系统)。这个应用程序需要能够读取大小> 2GB的文件。
我真的想使用iostream东西与FILE指针,但我找不到大文件#defines(_LARGEFILE_SOURCE,_LARGEFILE64_SOURCE,_FILE_OFFSET_BITS = 64)对iostream头有任何影响。
我在32位系统上编译。任何指针都会有所帮助。
谢谢!
已经在你编译 libstdc ++
时决定,通常取决于 _GLIBCXX_USE_LFS
是否在<$ c如果有疑问,请传递您的可执行文件(或 libstdc ++。)。
readelf -r
(或通过 strings
)动态链接)查看你的二进制文件/ libstdc ++
是否链接到 fopen
/ fseek
/等等。或 fopen64
/ fseek64
/ etc。 UPDATE
您不必担心2GB限制,只要您不需要/尝试 fseek
或 ftell
(您只是读取或写入串流)。
I'm trying to find a definitive answer and can't, so I'm hoping someone might know.
I'm developing a C++ app using GCC 4.x on Linux (32-bit OS). This app needs to be able to read files > 2GB in size.
I would really like to use iostream stuff vs. FILE pointers, but I can't find if the large file #defines (_LARGEFILE_SOURCE, _LARGEFILE64_SOURCE, _FILE_OFFSET_BITS=64) have any effect on the iostream headers.
I'm compiling on a 32-bit system. Any pointers would be helpful.
Thanks!
This has already been decided for you when libstdc++
was compiled, and normally depends on whether or not _GLIBCXX_USE_LFS
was defined in c++config.h
.
If in doubt, pass your executable (or libstdc++.so
, if linking against it dynamically) through readelf -r
(or through strings
) and see if your binary/libstdc++
linked against fopen
/fseek
/etc. or fopen64
/fseek64
/etc.
UPDATE
You don't have to worry about the 2GB limit as long as you don't need/attempt to fseek
or ftell
(you just read from or write to the stream.)
这篇关于iostream和大文件支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!