fixed a bug in the binary ofstream

'std::ios::binary' was missing in the ofstream initialization.