My file C2.et2 is fixed at 528,955,536 bytes.
My code:
unsigned int data[64],total[64];
(...)
counter[4]=0;
total[4]=filesize("C2.et2")/16;
//filesize(string representing filename) returns size in bytes: aforementioned value
//divided by 16 makes 33,059,721
(...)
ifstream fc2("C2.et2");
(...)
for(counter[4]=counter[4];counter[4]<total[4];counter[4]++)
{
cout<<"counter[4] = "<<counter[4]<<"\n";
fc2.seekg(16counter[4]); cout<<"seekg("<<fc2.tellg()<<")\n";
fc2.read((char)&data[4],4); cout<<"Now at "<<fc2.tellg()<<"\n";
fc2.read((char)&data[5],4); cout<<"Now at "<<fc2.tellg()<<"\n";
fc2.read((char)&data[6],4); cout<<"Now at "<<fc2.tellg()<<"\n";
fc2.read((char*)&data[7],4); cout<<"Now at "<<fc2.tellg()<<"\n";
(...)
}
By using appropriate system pauses I reach the following conclusion about the output:
For counter[4] 0 until 852 everything goes smoothly, example output:
counter[4] = 852;
seekg(13632)
Now at 13636
Now at 13640
Now at 13644
Now at 13648
Press any key to continue . . .
From then on, instead of every "now at" increasing by 4, strange things start to happen. Output:
counter[4] = 853;
seekg(13648)
Now at 13652
Now at 13656
Now at 13660
Now at 13667 (? +7)
Press any key to continue . . .
counter[4] = 854;
seekg(13664)
Now at 13675 (? +11)
Now at 13697 (? +22)
Now at 13741 (? +44)
Now at 13829 (? +88)
Press any key to continue . . .
At that point(854), if i call some routine to print data[4]-data[7], it generates runtime error.
However, if I don't, after awhile the program starts again to read 4 bytes at a time,
and at iteration 900 it totally resumes to the right (4*n) numbers!!!
What's happening?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
My file C2.et2 is fixed at 528,955,536 bytes.
My code:
unsigned int data[64],total[64];
(...)
counter[4]=0;
total[4]=filesize("C2.et2")/16;
//filesize(string representing filename) returns size in bytes: aforementioned value
//divided by 16 makes 33,059,721
(...)
ifstream fc2("C2.et2");
(...)
for(counter[4]=counter[4];counter[4]<total[4];counter[4]++)
{
cout<<"counter[4] = "<<counter[4]<<"\n";
fc2.seekg(16counter[4]); cout<<"seekg("<<fc2.tellg()<<")\n";
fc2.read((char)&data[4],4); cout<<"Now at "<<fc2.tellg()<<"\n";
fc2.read((char)&data[5],4); cout<<"Now at "<<fc2.tellg()<<"\n";
fc2.read((char)&data[6],4); cout<<"Now at "<<fc2.tellg()<<"\n";
fc2.read((char*)&data[7],4); cout<<"Now at "<<fc2.tellg()<<"\n";
(...)
}
By using appropriate system pauses I reach the following conclusion about the output:
For counter[4] 0 until 852 everything goes smoothly, example output:
counter[4] = 852;
seekg(13632)
Now at 13636
Now at 13640
Now at 13644
Now at 13648
Press any key to continue . . .
From then on, instead of every "now at" increasing by 4, strange things start to happen. Output:
counter[4] = 853;
seekg(13648)
Now at 13652
Now at 13656
Now at 13660
Now at 13667 (? +7)
Press any key to continue . . .
counter[4] = 854;
seekg(13664)
Now at 13675 (? +11)
Now at 13697 (? +22)
Now at 13741 (? +44)
Now at 13829 (? +88)
Press any key to continue . . .
At that point(854), if i call some routine to print data[4]-data[7], it generates runtime error.
However, if I don't, after awhile the program starts again to read 4 bytes at a time,
and at iteration 900 it totally resumes to the right (4*n) numbers!!!
What's happening?
Uhhhh, can I be so silly as to have forgotten ios::binary?
Probably.
Please disregard my post...