I was an NES emu author in a previous life. I'm always excited to see other people start work on an emu of their own. Please feel free to post questions about emulation on here... I freaking love this stuff.
That said... the problem is that the >> operator is designed for extracting text... and as part of that design, it throws away whitespace. 0x20 is a space character, so it is getting discarded.
So line 34:
file >> bin;
Should be replaced with:
file.read(&bin, sizeof(char));
The read() function does not do any text processing -- it just gives you whatever raw data is in the file. Unlike the >> operator.
EDIT:
Also -- great choice starting with nestest.nes. Get your CPU working first or else nothing will work. One nasty CPU bug can destroy the whole emu.