Click here to Skip to main content
15,885,546 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: What to do when GetOverlappedResult results in ERROR_IO_INCOMPLETE Pin
Code-o-mat8-Nov-10 21:30
Code-o-mat8-Nov-10 21:30 
Questionchar * - returning address of local variable or temporary Pin
piul8-Nov-10 5:11
piul8-Nov-10 5:11 
AnswerRe: char * - returning address of local variable or temporary Pin
Alain Rist8-Nov-10 5:23
Alain Rist8-Nov-10 5:23 
GeneralRe: char * - returning address of local variable or temporary Pin
piul8-Nov-10 5:29
piul8-Nov-10 5:29 
GeneralRe: char * - returning address of local variable or temporary Pin
Alain Rist8-Nov-10 5:59
Alain Rist8-Nov-10 5:59 
AnswerRe: char * - returning address of local variable or temporary Pin
jschell8-Nov-10 5:39
jschell8-Nov-10 5:39 
AnswerRe: char * - returning address of local variable or temporary Pin
David Crow8-Nov-10 5:40
David Crow8-Nov-10 5:40 
AnswerRe: char * - returning address of local variable or temporary Pin
Sauro Viti8-Nov-10 5:50
professionalSauro Viti8-Nov-10 5:50 
The problem is that you are returning a pointer to a buffer that will go out of scope after your function exit: then then returned pointer is no longer valid and what you find there is going to be pseudo-random.
To fix the problem you can:


  1. allocate the output buffer out from the function
  2. allocate the output buffer using new or malloc (but you should remember to deallocate it when it is no more needed)


However, as Alan said, the very best way is to stop using C-style strings and use std::string instead: the STL is one of the better solutions because all its classes are inlined and highly optimized. This will give you very good performances with a minimal footprint (the unused classes and methods simply are not compiled and don't affect the executable size).
AnswerRe: char * - returning address of local variable or temporary Pin
«_Superman_»8-Nov-10 7:03
professional«_Superman_»8-Nov-10 7:03 
AnswerRe: char * - returning address of local variable or temporary Pin
tom144312-Nov-10 2:26
tom144312-Nov-10 2:26 
Questionedit control not responding in a dialog created within an activex control Pin
lakshman rao8-Nov-10 2:59
lakshman rao8-Nov-10 2:59 
QuestionRe: edit control not responding in a dialog created within an activex control Pin
David Crow8-Nov-10 3:36
David Crow8-Nov-10 3:36 
AnswerRe: edit control not responding in a dialog created within an activex control Pin
lakshman rao8-Nov-10 3:48
lakshman rao8-Nov-10 3:48 
QuestionRe: edit control not responding in a dialog created within an activex control Pin
David Crow8-Nov-10 3:51
David Crow8-Nov-10 3:51 
AnswerRe: edit control not responding in a dialog created within an activex control Pin
lakshman rao8-Nov-10 3:55
lakshman rao8-Nov-10 3:55 
GeneralRe: edit control not responding in a dialog created within an activex control Pin
lakshman rao18-Nov-10 23:47
lakshman rao18-Nov-10 23:47 
QuestionTranslate C-Code to Csharp Pin
djfresh8-Nov-10 2:16
djfresh8-Nov-10 2:16 
AnswerRe: Translate C-Code to Csharp Pin
Sauro Viti8-Nov-10 2:24
professionalSauro Viti8-Nov-10 2:24 
GeneralRe: Translate C-Code to Csharp Pin
djfresh8-Nov-10 2:51
djfresh8-Nov-10 2:51 
GeneralRe: Translate C-Code to Csharp Pin
Sauro Viti8-Nov-10 3:31
professionalSauro Viti8-Nov-10 3:31 
GeneralRe: Translate C-Code to Csharp Pin
djfresh8-Nov-10 3:47
djfresh8-Nov-10 3:47 
AnswerRe: Translate C-Code to Csharp Pin
Sauro Viti8-Nov-10 4:07
professionalSauro Viti8-Nov-10 4:07 
GeneralRe: Translate C-Code to Csharp Pin
djfresh9-Nov-10 2:12
djfresh9-Nov-10 2:12 
AnswerRe: Translate C-Code to Csharp Pin
Luc Pattyn8-Nov-10 4:07
sitebuilderLuc Pattyn8-Nov-10 4:07 
QuestionWhy SampleGrabber->SetOneShot(FALSE) fails with video files? Pin
Chesnokov Yuriy8-Nov-10 0:12
professionalChesnokov Yuriy8-Nov-10 0:12 

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.