I'm trying to improve some file loading & have the following;
fHandle.seekg(0,std::ios::end); ////fHandle is fstream.
std::streampos length = fHandle.tellg();
//streambuffer.rdbuf()->pubsetbuf(&buffer,length); //1.0 crashes with this on large files ? Memory usage also increases substantially.
//2.0 compiles & loads file except has issue with extracting data beyond first lot of bytes.
string stringtemp = &buffer;
unsigned int Data = 0;
int filepos = 0;
//data beyond this can not get extracted ? i.e. following will not extract data properly.
filepos = 4;
Problem is, one (1) alternative crashes on large files. The second (2) method has an issue with extracting data. So I'm wondering what am I doing wrong; or even, if there's a better/more efficient way of handling this.