vijayan121, I don't think ifstream works for files over 2GB, which mine is. (7GB)
true, unless you are using a standard library implementation like one from dinkumware, and that too on a
64-bit architecture.
here is something you could try.
a. map chunks of the file (say 256 MB each) into memory.
how you would do this depends on the platform:
unix: use mmap (compile with -D_FILE_OFFSET_BITS=64 to make sure that off_t is a 64-bit value.
linux: same as unix, but i think kernels prior to something like 2.6.10 are buggy with large
files which are memory mapped.
windows: the CreateFile/CreateFileMapping/MapViewOfFile triplet
b. wrap an
stlsoft::basic_string_view<char> around the chunk that is mapped.
eg.
stlsoft::basic_string_view<char> str( static_cast<const char*>(address), nchars ) ;
download stlsoft from
http://www.synesis.com.au/software/stlsoft.
for basic_string_view<> documentation, see:
http://www.synesis.com.au/software/s...ing__view.html
stlsoft library is header-only; you need only #include the requisite files to access the functionality.
c.
stlsoft::basic_string_view<> does not have the find family member functions as in std::string;
but do have provide polymorphic iterators. so, functions like find in the <algorithm> header
could be used.
eg. std::find( str.begin(), str.end(), '*' ) ;