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

C / C++ / MFC

 
GeneralRe: Issue while Use DLL in MFC Exe Application Pin
Andraw Tang31-Mar-11 9:33
Andraw Tang31-Mar-11 9:33 
GeneralRe: Issue while Use DLL in MFC Exe Application Pin
Albert Holguin31-Mar-11 9:38
professionalAlbert Holguin31-Mar-11 9:38 
GeneralRe: Issue while Use DLL in MFC Exe Application Pin
Andraw Tang31-Mar-11 10:53
Andraw Tang31-Mar-11 10:53 
GeneralRe: Issue while Use DLL in MFC Exe Application Pin
Albert Holguin31-Mar-11 11:00
professionalAlbert Holguin31-Mar-11 11:00 
QuestionAnything wrong Pin
Smith#31-Mar-11 4:46
Smith#31-Mar-11 4:46 
AnswerRe: Anything wrong [modified] Pin
Luc Pattyn31-Mar-11 5:17
sitebuilderLuc Pattyn31-Mar-11 5:17 
GeneralRe: Anything wrong Pin
Smith#31-Mar-11 5:33
Smith#31-Mar-11 5:33 
AnswerRe: Anything wrong Pin
Luc Pattyn31-Mar-11 7:18
sitebuilderLuc Pattyn31-Mar-11 7:18 
Smith# wrote:
char chz[4]={0};


this buffer is too small, your sprintf statement may generate a minus sign, three digits, a space, and a NULL, that is 6 characters.

60 of these could take up to 301 chars, so char szLogBuff [512]={0}; is sufficiently large, and as others already pointed out, your total initialization is a waste, as each strcat will move the initial terminating NULL backwards.

BTW: you could get the correct result with less code, and save some cycles, and never have the bug you had, by having sprintf() fill the final buffer right away; all it takes is a variable pointer as the destination, initialized to szLogBuff, and incremented by the return value of sprintf!

Smile | :)
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.

GeneralRe: Anything wrong Pin
CPallini31-Mar-11 7:37
mveCPallini31-Mar-11 7:37 
AnswerRe: Anything wrong Pin
Luc Pattyn31-Mar-11 7:41
sitebuilderLuc Pattyn31-Mar-11 7:41 
GeneralRe: Anything wrong Pin
CPallini31-Mar-11 8:02
mveCPallini31-Mar-11 8:02 
GeneralRe: Anything wrong Pin
Luc Pattyn31-Mar-11 8:09
sitebuilderLuc Pattyn31-Mar-11 8:09 
GeneralRe: Anything wrong Pin
CPallini31-Mar-11 8:17
mveCPallini31-Mar-11 8:17 
AnswerRe: Anything wrong Pin
CPallini31-Mar-11 5:44
mveCPallini31-Mar-11 5:44 
GeneralRe: Anything wrong Pin
Smith#31-Mar-11 5:52
Smith#31-Mar-11 5:52 
GeneralRe: Anything wrong Pin
Waldermort31-Mar-11 6:14
Waldermort31-Mar-11 6:14 
GeneralRe: Anything wrong Pin
Smith#31-Mar-11 6:22
Smith#31-Mar-11 6:22 
GeneralRe: Anything wrong Pin
Waldermort31-Mar-11 6:35
Waldermort31-Mar-11 6:35 
GeneralRe: Anything wrong Pin
Luc Pattyn31-Mar-11 7:18
sitebuilderLuc Pattyn31-Mar-11 7:18 
GeneralRe: Anything wrong Pin
CPallini31-Mar-11 7:36
mveCPallini31-Mar-11 7:36 
GeneralRe: Anything wrong Pin
Luc Pattyn31-Mar-11 7:39
sitebuilderLuc Pattyn31-Mar-11 7:39 
GeneralRe: Anything wrong Pin
CPallini31-Mar-11 8:02
mveCPallini31-Mar-11 8:02 
QuestionCompare And Set 64 bit Pin
Waldermort31-Mar-11 1:40
Waldermort31-Mar-11 1:40 
AnswerRe: Compare And Set 64 bit Pin
Klaus-Werner Konrad31-Mar-11 9:06
Klaus-Werner Konrad31-Mar-11 9:06 
QuestionNeed help on windows socket programming Pin
John50231-Mar-11 0:30
John50231-Mar-11 0:30 

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.