Click here to Skip to main content
16,005,162 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Need to help in file reading in win32 Pin
Roger Stoltz18-Jan-07 2:05
Roger Stoltz18-Jan-07 2:05 
GeneralRe: Need to help in file reading in win32 Pin
amitmistry_petlad 18-Jan-07 16:36
amitmistry_petlad 18-Jan-07 16:36 
GeneralRe: Need to help in file reading in win32 Pin
Roger Stoltz18-Jan-07 21:19
Roger Stoltz18-Jan-07 21:19 
GeneralRe: Need to help in file reading in win32 Pin
amitmistry_petlad 18-Jan-07 0:41
amitmistry_petlad 18-Jan-07 0:41 
Questionheap or stack? Pin
himuskanhere17-Jan-07 23:30
himuskanhere17-Jan-07 23:30 
AnswerRe: heap or stack? Pin
toxcct17-Jan-07 23:46
toxcct17-Jan-07 23:46 
AnswerRe: heap or stack? Pin
Roger Stoltz17-Jan-07 23:51
Roger Stoltz17-Jan-07 23:51 
AnswerRe: heap or stack? Pin
James R. Twine18-Jan-07 6:08
James R. Twine18-Jan-07 6:08 
rahul.shendurnikar wrote:
char ch[10];
CString str ="Rahul"


   Both of those allocate the specified objects on the stack - that is, the array of char and the CString object will be allocated on the stack.

   However, note the memory used by the CString object will be allocated on the heap, because that is how CStrings work.  In other words, you are causing two kinds of allocations when really only one is required.  Oh, and since heap allocation operations can raise exceptions, you should be assigning to that string object in a try/catch block just to be safe! Smile | :)

   Note that you are getting really lucky by using memcpy to copy into the string object's buffer - that is generally not the correct way to get data into or out of a real object.

   Peace!

-=- James
Please rate this message - let me know if I helped or not!<HR>If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong!
Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road!
See DeleteFXPFiles

GeneralRe: heap or stack? Pin
Mark Salsbery18-Jan-07 6:36
Mark Salsbery18-Jan-07 6:36 
GeneralRe: heap or stack? Pin
James R. Twine18-Jan-07 8:27
James R. Twine18-Jan-07 8:27 
GeneralRe: heap or stack? Pin
Mark Salsbery18-Jan-07 8:41
Mark Salsbery18-Jan-07 8:41 
QuestionKey Events Pin
baerten17-Jan-07 23:24
baerten17-Jan-07 23:24 
AnswerRe: Key Events Pin
malaugh18-Jan-07 7:09
malaugh18-Jan-07 7:09 
GeneralRe: Key Events Pin
baerten18-Jan-07 21:27
baerten18-Jan-07 21:27 
QuestionHow to set the position of the blinking text cursor in a CEdit box. Pin
whatever@whatever.com17-Jan-07 23:12
whatever@whatever.com17-Jan-07 23:12 
AnswerRe: How to set the position of the blinking text cursor in a CEdit box. Pin
prasad_som17-Jan-07 23:19
prasad_som17-Jan-07 23:19 
GeneralRe: How to set the position of the blinking text cursor in a CEdit box. Pin
James R. Twine18-Jan-07 6:10
James R. Twine18-Jan-07 6:10 
GeneralRe: How to set the position of the blinking text cursor in a CEdit box. Pin
whatever@whatever.com18-Jan-07 14:01
whatever@whatever.com18-Jan-07 14:01 
AnswerRe: How to set the position of the blinking text cursor in a CEdit box. Pin
Rajasekharan Vengalil17-Jan-07 23:57
Rajasekharan Vengalil17-Jan-07 23:57 
GeneralRe: How to set the position of the blinking text cursor in a CEdit box. Pin
whatever@whatever.com18-Jan-07 14:00
whatever@whatever.com18-Jan-07 14:00 
AnswerRe: How to set the position of the blinking text cursor in a CEdit box. Pin
James R. Twine18-Jan-07 6:17
James R. Twine18-Jan-07 6:17 
GeneralRe: How to set the position of the blinking text cursor in a CEdit box. Pin
whatever@whatever.com18-Jan-07 14:03
whatever@whatever.com18-Jan-07 14:03 
QuestionA doubt about templates Pin
toxcct17-Jan-07 23:04
toxcct17-Jan-07 23:04 
AnswerRe: A doubt about templates Pin
sunit517-Jan-07 23:26
sunit517-Jan-07 23:26 
GeneralRe: A doubt about templates Pin
toxcct17-Jan-07 23:29
toxcct17-Jan-07 23:29 

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.