I was wondering if someone could help me figure out how to read from a text file in C++, character by character. That way, I could have a while loop (while there\'s still te
There is no reason not to use C in C++, and in fact it is often the optimal choice.
#include
int
main() // (void) not necessary in C++
{
int c;
while ((c = getchar()) != EOF) {
// do something with 'c' here
}
return 0; // technically not necessary in C++ but still good style
}