Reading in a binary file but looking for decimal character

Mar 8, 2013 at 5:32pm
I'm given code that reads in a file in binary. I can access any character in the
binary file as a position in an array, for example:

ReadFile thefile("TestFile.bin");

cout << thefile[3] << endl;

would output the 4th character in this binary file.

I need to read this file through, and output how many characters in it are of a
certain decimal value, for example, decimal value 65 == A.

How might I read in a binary file yet look for a decimal value? If a loop is used
checking thefile[i] reports back the actual character, not the
decimal value of that character. So I'm not sure how to count how many instances
of decimal 65 occur in the file?
Mar 8, 2013 at 5:39pm
A character is a number, they just often don't get treated as such. Just think of it as an 8-bit integer and it will make sense to you (because that's actually how it is)
Topic archived. No new replies allowed.