> Should this be opened with the binary flag for Windows?

I've been reading up on this. I'm not sure there would ever be a case where text mode would fail, but binary mode appears to be the safer option.

(There may also be an issue of endianess which I have conveniently ignored. ;) )