EDIT: move along, nothing to see here....haha....erm, sorry. After I posted this, realised I may of been passing the wrong variable . Hence my confusion :/. Don't need help with this now. Thanks for looking.
hi,
I have a reference book that states that gcount() returns the actual number of characters read.
I am wondering how does this work with compressed files? I ask because I am getting mixed results with some code I have for compressed files (no problem with non-compressed files).
Snippet code
Code:
//For compressed files
if((iUserDisplayNum<FileCount)&&(abCompressed[iUserDisplayNum] == 1)) //1 for compressed
{
int filesize = aiDecompressedSize[iUserDisplayNum]; //contains decompressed size info
char *read_filedata_array = new char[filesize];
filepos = (FileLoc[iUserDisplayNum].Location)+4; //file position
File.seekp(filepos);
File.seekg(filepos);
File.read(read_filedata_array,filesize); //read-in data at location n
cout<<"filesize: "<<filesize<<endl;
cout<<"gcount(): "<<File.gcount()<<endl;
delete[] read_filedata_array;
File.clear();
}
I am getting different gcount() results depending on the location-structuring of the data I am reading in; filesize is always right, but gcount() is not. Sometimes gcount() is equal to filesize, but not always.
If I test the size/lenght of the data after decompressing it, more often than not it is returning the same size as the filesize (sometimes more/less, depending on the data).
So my puzzlement is, that even though I am getting different results (gcount() is always same/lower than filesize), it is actually (or so it seems) properly reading in all the compressed data?
Someone able to explain why then that gcount() may not properly be returning the correct value? Or is there more to it?
Thanks.