Hi there,
in my binary file i want read something but from 4th byte.
i need to read data as 2 bytes int.
i have this code but im not sure if its ok:
some of my files should have some values less than 0, and im not getting any..so i believe my code is bad.....
fstream datafile("file.dat",ios::binary|ios::in);
if (!datafile){
cerr << "Error opening file!"<<endl;
exit(1);
}
for(i=4; i<100;i=i+2){
datafile.seekg(i,ios::beg);
datafile.read((char*)&dataCount,2*sizeof(char));
cout << dataCount << ";" << endl;
}