S
shrishjain
Dear All,
I am having problem in reading bytes from a binary file. I read the
file in following way:
ifstream in("filename");
char c[1];
while(true) {
in.read(&c[0], 1);
if(in.eof()){
cout<<"end of file\n";
break;
}
}
The above code does not read all the file. I find that in.eof() returns
true much before the file really ends. It would be great if someone can
explain me why it is happening this way.
Thanks,
Shrish
I am having problem in reading bytes from a binary file. I read the
file in following way:
ifstream in("filename");
char c[1];
while(true) {
in.read(&c[0], 1);
if(in.eof()){
cout<<"end of file\n";
break;
}
}
The above code does not read all the file. I find that in.eof() returns
true much before the file really ends. It would be great if someone can
explain me why it is happening this way.
Thanks,
Shrish