F
Felix.leg
Hi,
I have got a strange behavior in my fstream library, I suppose (I'm
using "g++ (Ubuntu 4.4.3-4ubuntu5) 4.4.3"). Even with a simple code
like this:
It reads right until the end of file. Then it reads the last character
twice.
Is my library broken? Or it is me doing it wrong?
I have got a strange behavior in my fstream library, I suppose (I'm
using "g++ (Ubuntu 4.4.3-4ubuntu5) 4.4.3"). Even with a simple code
like this:
Code:
#include <iostream>
#include <fstream>
using namespace std;
int main (int argc, char **argv)
{
ifstream afile("chars" , ifstream::in );
char z;
while( afile.good() ) {
afile.get(z);
cout << " '" << z << "' ";
}
cout << endl;
afile.close();
return 0;
}
twice.
Is my library broken? Or it is me doing it wrong?