Difference between revisions of "Talk:CPP/BinaryIO"
From ProgrammingExamples
< Talk:CPP
(Created page with '<code> string Filename = "Test.bin";<br> ofstream fout(Filename.c_str());<br> </code><br> "Test.bin" is in the static data segment, then copied to a string's buffer, if the strin…') |
(No difference)
|
Revision as of 16:55, 3 July 2010
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);