In C, EOF is a macro defined in stdio.h. I wonder is there a C++ equivalent to it (a const int or sth)?
What do I want it for? For example, I may want to implement a SeekEof():
// Is there any non-space character remaining?
bool SeekEof(std::istream &in) {
int c(0);
while ((c = in.peek()) != EOF &&
(c == ' ' || c == '\t' ||
c == '\r' || c == '\n')) in.get();
return c == EOF ;
}
1 Answer