C++ 64位STD::支持OFSH 我将从使用一些旧代码到使用C++流的标准文件指针进行转换,但我需要有大文件寻求支持。激活该支持的编译器标志是:-DyFielyOffStIsBITS=64等,我可以通过使用OFF64 64数据类型来获得。p> 关于这个主题和C API,现在我希望能够过渡到使用C++流。 在C++中,相同的标志触发文件流的查找能力?

C++ 64位STD::支持OFSH 我将从使用一些旧代码到使用C++流的标准文件指针进行转换,但我需要有大文件寻求支持。激活该支持的编译器标志是:-DyFielyOffStIsBITS=64等,我可以通过使用OFF64 64数据类型来获得。p> 关于这个主题和C API,现在我希望能够过渡到使用C++流。 在C++中,相同的标志触发文件流的查找能力?,c++,linux,64-bit,large-files,C++,Linux,64 Bit,Large Files,,所以我对16GB文件进行了快速测试,似乎已经工作了。这是我使用的代码 // compiled with : g++ -o largefile -D_FILE_OFFSET_BITS=64 largefile.cpp #include "iostream" #include "fstream" int main (int argc, char * argv[]) { char line[4096]; std::ifstream stream ("/home/jb

,所以我对16GB文件进行了快速测试,似乎已经工作了。这是我使用的代码

// compiled with : g++ -o largefile -D_FILE_OFFSET_BITS=64 largefile.cpp
#include "iostream"
#include "fstream"

int
main (int argc, char * argv[]) {
        char line[4096];
        std::ifstream stream ("/home/jbellone/largefile.csv");

        // Seek forward to somewhere past 4GB
        stream.seekg (10294967296, std::ios_base::beg);

        stream.getline (line, 100);

        std::cout << stream.tellg() << " " << line << "\n";      
}

因此,我对一个16GB的文件进行了一个快速测试,它似乎起到了作用。这是我使用的代码

// compiled with : g++ -o largefile -D_FILE_OFFSET_BITS=64 largefile.cpp
#include "iostream"
#include "fstream"

int
main (int argc, char * argv[]) {
        char line[4096];
        std::ifstream stream ("/home/jbellone/largefile.csv");

        // Seek forward to somewhere past 4GB
        stream.seekg (10294967296, std::ios_base::beg);

        stream.getline (line, 100);

        std::cout << stream.tellg() << " " << line << "\n";      
}