[ad_1]
I would do this like this:
std::ifstream infile("myfile.txt");
char ch;
while(infile.get(ch))
{
... process ch ...
}
This avoids the problems that appear on the last character, or having to read a character before the first iteration of the loop.
[ad_2]
solved How to read the entire content of a file character by character?