Click here to Skip to main content
15,891,673 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: What to do when GetOverlappedResult results in ERROR_IO_INCOMPLETE Pin
«_Superman_»8-Nov-10 9:37
professional«_Superman_»8-Nov-10 9:37 
GeneralRe: What to do when GetOverlappedResult results in ERROR_IO_INCOMPLETE Pin
Code-o-mat8-Nov-10 10:04
Code-o-mat8-Nov-10 10:04 
GeneralRe: What to do when GetOverlappedResult results in ERROR_IO_INCOMPLETE Pin
«_Superman_»8-Nov-10 10:12
professional«_Superman_»8-Nov-10 10:12 
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 
piul wrote:
my boss does not think the same. I have mentioned him several times that it is more secure to use std::string or any other, but apparently it is best to use char * and home cooked functions for the system the application will run in.
I sympathize Sigh | :sigh: Try find another job or another boss Smile | :)
Meanwhile:
piul wrote:
char * Func (char * sT)
{
	char sRet [MAX_STR_SIZE] = "";
	strcpy (sRet, sT);
	return sRet;
}
And when compiling I get a warning returning address of local variable or temporary

Your nice compiler warns you that sRet points to deallocated memory when returned.

A solution is to make sRet static: static char sRet [MAX_STR_SIZE] = {0};.
It will be overwritten on each call but valid on return.
For safety use strncpy(sRet, sT, MAX_STR_SIZE - 1).
cheers,
AR
When the wise (person) points at the moon the fool looks at the finger (Chinese proverb)

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 
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 

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.