Click here to Skip to main content
16,012,116 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: how to cast cstring into char*? Pin
David Crow22-Jun-04 8:25
David Crow22-Jun-04 8:25 
GeneralRe: how to cast cstring into char*? Pin
Nitron22-Jun-04 8:48
Nitron22-Jun-04 8:48 
GeneralRe: how to cast cstring into char*? Pin
James R. Twine22-Jun-04 8:32
James R. Twine22-Jun-04 8:32 
GeneralRe: how to cast cstring into char*? Pin
vividwu22-Jun-04 8:13
vividwu22-Jun-04 8:13 
GeneralRe: how to cast cstring into char*? Pin
David Crow22-Jun-04 8:22
David Crow22-Jun-04 8:22 
GeneralRe: how to cast cstring into char*? Pin
mtzlplyk22-Jun-04 10:47
mtzlplyk22-Jun-04 10:47 
AnswerRe: how to cast cstring into char*? Pin
vcplusplus22-Jun-04 7:44
vcplusplus22-Jun-04 7:44 
GeneralRe: how to cast cstring into char*? Pin
James R. Twine22-Jun-04 8:26
James R. Twine22-Jun-04 8:26 
      // MSDN example for CString::GetBuffer<br />
      CString s( "abcd" );<br />
      LPTSTR p = s.GetBuffer( 10 );<br />
      strcpy( p, "Hello" );   // directly access CString buffers.<br />
      ReleaseBuffer( );


   Yes, yet another bad example from MSDN!  No enforcement of the buffer size obtained (should have used strncpy(...)), and no exception handling for example.

   IOW, typical high-quality MSDN documentation/examples that newer developers can learn all kinds of bad habits from! Smile | :)

   Peace!

-=- James
Tip for SUV winter driving survival: "Professional Driver on Closed Course" does not mean "your Dumb Ass on a Public Road"!
Articles -- Products: Delete FXP Files & Check Favorites

GeneralRe: how to cast cstring into char*? Pin
palbano22-Jun-04 8:39
palbano22-Jun-04 8:39 
GeneralRe: how to cast cstring into char*? Pin
Nitron22-Jun-04 8:50
Nitron22-Jun-04 8:50 
GeneralRe: how to cast cstring into char*? Pin
James R. Twine22-Jun-04 11:00
James R. Twine22-Jun-04 11:00 
GeneralRe: how to cast cstring into char*? Pin
vividwu22-Jun-04 8:27
vividwu22-Jun-04 8:27 
GeneralRe: how to cast cstring into char*? Pin
Ryan Binns22-Jun-04 18:34
Ryan Binns22-Jun-04 18:34 
AnswerRe: how to cast cstring into char*? Pin
Nitron22-Jun-04 8:02
Nitron22-Jun-04 8:02 
GeneralRe: how to cast cstring into char*? Pin
David Crow22-Jun-04 8:24
David Crow22-Jun-04 8:24 
GeneralRe: how to cast cstring into char*? Pin
Nitron22-Jun-04 8:44
Nitron22-Jun-04 8:44 
GeneralRe: how to cast cstring into char*? Pin
David Crow22-Jun-04 9:20
David Crow22-Jun-04 9:20 
GeneralRe: how to cast cstring into char*? Pin
vividwu22-Jun-04 8:57
vividwu22-Jun-04 8:57 
GeneralRe: how to cast cstring into char*? Pin
palbano22-Jun-04 9:35
palbano22-Jun-04 9:35 
AnswerRe: how to cast cstring into char*? Pin
mtzlplyk22-Jun-04 10:33
mtzlplyk22-Jun-04 10:33 
GeneralSimple Question - About Box Pin
sweep12322-Jun-04 6:50
sweep12322-Jun-04 6:50 
GeneralRe: Simple Question - About Box Pin
Maximilien22-Jun-04 6:52
Maximilien22-Jun-04 6:52 
GeneralRe: Simple Question - About Box Pin
Ryan Binns22-Jun-04 18:38
Ryan Binns22-Jun-04 18:38 
GeneralRe: Simple Question - About Box Pin
jmkhael22-Jun-04 7:01
jmkhael22-Jun-04 7:01 
GeneralRe: Simple Question - About Box Pin
David Crow22-Jun-04 7:32
David Crow22-Jun-04 7:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.