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…') |
Daviddoria (Talk | contribs) |
||
Line 8: | Line 8: | ||
ofstream fout(Filename);<br> | ofstream fout(Filename);<br> | ||
</code> | </code> | ||
+ | |||
+ | : This one I'm not very familiar with at all. You're the boss. Please update the example with these changes (being sure to add some explanatory comments :) ). [[User:Daviddoria|Daviddoria]] 06:10, 4 July 2010 (UTC) |
Latest revision as of 02:10, 4 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);
- This one I'm not very familiar with at all. You're the boss. Please update the example with these changes (being sure to add some explanatory comments :) ). Daviddoria 06:10, 4 July 2010 (UTC)