Talk:CPP/BinaryIO
From ProgrammingExamples
string Filename = "Test.bin";
ofstream fout(Filename.c_str());
"Test.bin" is in the static data segment, then copied to a string's buffer, if the string is never going to be modified, why not point to the static data segment like that:
const char* Filename = "Test.bin";
ofstream fout(Filename);