Talk:CPP/BinaryIO

From ProgrammingExamples
< Talk:CPP
Revision as of 16:55, 3 July 2010 by Anonymous (Talk)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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);