+1  A: 

This:

ios_base::open_mode Mode = std::ios_base::in | std::ios_base::binary;

should be:

std::ios_base::openmode Mode = std::ios_base::in | std::ios_base::binary;

Note the lack of _ in openmode.

(I had to add these lines and put your code in a function to get your snippet to compile.

#include <string>
#include <fstream>

using std::string;
using std::ofstream;
using std::ios_base;

)

Charles Bailey
A: 

openmode is the correct type, not open_mode.

ergosys
It worked! Thanks!
Dylan Klomparens
A: 

g++ is not totally conforming, but it's not the reason for the error here.

The type of mode should be

std::ios_base::openmode

instead of

std::ios_base::open_mode

The latter is an old, deprecated API. It is still specified in Annex D of the C++ standard, so the compiler still have to support it.

KennyTM