Click here to Skip to main content
16,019,614 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: exceptions Pin
jon-8023-Aug-06 4:50
professionaljon-8023-Aug-06 4:50 
QuestionHide window Pin
Manjunath S22-Aug-06 8:46
Manjunath S22-Aug-06 8:46 
AnswerRe: Hide window Pin
Jun Du22-Aug-06 9:39
Jun Du22-Aug-06 9:39 
AnswerRe: Hide window Pin
eusto22-Aug-06 9:44
eusto22-Aug-06 9:44 
QuestionError: Run-Time Check Failure #2 - Stack around the variable 'password' was corrupted. Pin
jon-8022-Aug-06 7:59
professionaljon-8022-Aug-06 7:59 
AnswerRe: Error: Run-Time Check Failure #2 - Stack around the variable 'password' was corrupted. Pin
Cedric Moonen22-Aug-06 8:23
Cedric Moonen22-Aug-06 8:23 
GeneralRe: Error: Run-Time Check Failure #2 - Stack around the variable 'password' was corrupted. Pin
jon-8022-Aug-06 8:42
professionaljon-8022-Aug-06 8:42 
GeneralRe: Error: Run-Time Check Failure #2 - Stack around the variable 'password' was corrupted. Pin
Cedric Moonen22-Aug-06 8:48
Cedric Moonen22-Aug-06 8:48 
You return the address of the array of char (don't forget that char* is a pointer). This array is created locally in the function (so the memory is reserved in the function). When you reach the end of the function, the array comes out of scope (because its scope is limited to the function). Thus the memory will be freed automaticaly. The contents may still be the same but they are not protected anymore (meaning that anything can override your array). And of course, the pointer that you return still point at the same location (not protected).

You have to take care of the warnings generated by your compiler. Normally, this should have appeared in the warnings ('warning: returning address of temporary variable', or something like that).


Cédric Moonen
Software developer

Charting control [Updated - v1.1]

GeneralRe: Error: Run-Time Check Failure #2 - Stack around the variable 'password' was corrupted. Pin
jon-8022-Aug-06 8:58
professionaljon-8022-Aug-06 8:58 
GeneralRe: Error: Run-Time Check Failure #2 - Stack around the variable 'password' was corrupted. Pin
Zac Howland22-Aug-06 9:25
Zac Howland22-Aug-06 9:25 
AnswerRe: Error: Run-Time Check Failure #2 - Stack around the variable 'password' was corrupted. Pin
Zac Howland22-Aug-06 9:38
Zac Howland22-Aug-06 9:38 
QuestionRadio Power Button Pin
siddhen22-Aug-06 7:31
siddhen22-Aug-06 7:31 
AnswerRe: Radio Power Button Pin
toxcct22-Aug-06 8:39
toxcct22-Aug-06 8:39 
Questionhow to create a table in the database using mfc Pin
vc++_fragrance22-Aug-06 4:46
vc++_fragrance22-Aug-06 4:46 
AnswerRe: how to create a table in the database using mfc Pin
Sarath C22-Aug-06 5:09
Sarath C22-Aug-06 5:09 
AnswerRe: how to create a table in the database using mfc Pin
Sarath C22-Aug-06 5:18
Sarath C22-Aug-06 5:18 
AnswerRe: how to create a table in the database using mfc Pin
David Crow22-Aug-06 6:07
David Crow22-Aug-06 6:07 
AnswerRe: how to create a table in the database using mfc Pin
vc++_fragrance22-Aug-06 22:35
vc++_fragrance22-Aug-06 22:35 
QuestionCode of RoundedRect() Function? Pin
prabhashmandal22-Aug-06 4:23
prabhashmandal22-Aug-06 4:23 
AnswerRe: Code of RoundedRect() Function? Pin
Sarath C22-Aug-06 4:58
Sarath C22-Aug-06 4:58 
QuestionBest way to control a LCD display using C++? Pin
xkrja22-Aug-06 3:50
xkrja22-Aug-06 3:50 
AnswerRe: Best way to control a LCD display using C++? Pin
Rage22-Aug-06 4:23
professionalRage22-Aug-06 4:23 
GeneralRe: Best way to control a LCD display using C++? Pin
xkrja22-Aug-06 8:13
xkrja22-Aug-06 8:13 
GeneralRe: Best way to control a LCD display using C++? Pin
Richard Andrew x6422-Aug-06 12:34
professionalRichard Andrew x6422-Aug-06 12:34 
GeneralRe: Best way to control a LCD display using C++? Pin
Jörgen Sigvardsson22-Aug-06 15:04
Jörgen Sigvardsson22-Aug-06 15:04 

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.