[Solved] How to read the entire content of a file character by character?


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.

solved How to read the entire content of a file character by character?