I work with ifstream . I read until the EOF bit is set (I need it that way).
Why then this does not work:
// IN is ifstream file. CH is char. if (IN.eof()) { IN.seekg(ios::beg); IN.clear(); if (read((char*)&CH, sizeof(CH))) cout << "Succes."; else cout << "Not S."; }
The read function does not work at any time. I am trying to use IN.setstate(ifstream::goodbit) instead of IN.clear() too. But this is the same, am I right?
Nanik
source share