Search for large files with ifstream

I am implementing a C ++ program using ifstream, which should search in large files (~ 1 TB). However, this fails after reading 2 GB. Is there a way to get file positions, even for large files? I am compiling for a 32 bit Windows machine.

std::ifstream f; f.open( filename.c_str(), std::ifstream::in | std::ifstream::binary ); while(true) { std::cout << (uint64_t)(f.tellg()) << std::endl; //read data } 
+6
source share
1 answer

Since you are compiling a 32-bit platform, if you use fstream , you will get 32-bit access. To access large files, you need to use a platform dependent solution:

+1
source

Source: https://habr.com/ru/post/920301/


All Articles