Click here to Skip to main content
15,918,976 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralCAsyncSocket Pin
xSoptik13-Aug-05 10:18
xSoptik13-Aug-05 10:18 
GeneralRe: CAsyncSocket Pin
S Douglas15-Aug-05 1:47
professionalS Douglas15-Aug-05 1:47 
GeneralWindow sizing by actual string and font Pin
xSoptik13-Aug-05 9:53
xSoptik13-Aug-05 9:53 
GeneralRe: Window sizing by actual string and font Pin
PJ Arends13-Aug-05 10:07
professionalPJ Arends13-Aug-05 10:07 
General*char problem Pin
Axonn Echysttas13-Aug-05 9:09
Axonn Echysttas13-Aug-05 9:09 
GeneralRe: *char problem Pin
PJ Arends13-Aug-05 10:04
professionalPJ Arends13-Aug-05 10:04 
GeneralRe: *char problem Pin
Axonn Echysttas13-Aug-05 10:51
Axonn Echysttas13-Aug-05 10:51 
GeneralRe: *char problem Pin
John R. Shaw13-Aug-05 20:44
John R. Shaw13-Aug-05 20:44 
1) Do not allocate the buffers (unless you have to). Not only is this bad programing, I see that you do not free them (memory leaks).

2) You are changing the memory address stored in cText from what you allocated to the address of a static string (consisting of only 17 characters[boom - memory leak]).

void Test(long lSomeValue)
{
char cValue[15];
char cText[50] = "The number is: "; // or {"The number is: "};
strcat(cTest,_ltoa(lSomeValue, cValue, 10));
MessageBox(0, cText, "bla", 0);
}

Note (above): No (C) memory allocations was required (every thing is on the stack). The pointer returned by _ltoa() is a pointer to cValue (no error return), so you can combine the two function calls into one.



INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
GeneralRe: *char problem Pin
Axonn Echysttas14-Aug-05 19:17
Axonn Echysttas14-Aug-05 19:17 
QuestionHow to change the icon of program by Visual C++ 6.0 Pin
Victor Lin13-Aug-05 5:45
Victor Lin13-Aug-05 5:45 
AnswerRe: How to change the icon of program by Visual C++ 6.0 Pin
Achim Klein13-Aug-05 7:43
Achim Klein13-Aug-05 7:43 
AnswerRe: How to change the icon of program by Visual C++ 6.0 Pin
cpprules13-Aug-05 12:55
cpprules13-Aug-05 12:55 
QuestionWhere I make mistake in getting input boxes from html page? Pin
Alex Shapovalov13-Aug-05 4:49
professionalAlex Shapovalov13-Aug-05 4:49 
GeneralHexEncoder class to CString Pin
Member 207257813-Aug-05 4:07
Member 207257813-Aug-05 4:07 
GeneralRe: HexEncoder class to CString Pin
Jose Lamas Rios13-Aug-05 7:14
Jose Lamas Rios13-Aug-05 7:14 
GeneralRe: HexEncoder class to CString Pin
Member 207257813-Aug-05 20:24
Member 207257813-Aug-05 20:24 
GeneralRe: HexEncoder class to CString Pin
Member 207257814-Aug-05 6:59
Member 207257814-Aug-05 6:59 
GeneralRe: HexEncoder class to CString Pin
Member 207257816-Aug-05 3:29
Member 207257816-Aug-05 3:29 
GeneralRe: HexEncoder class to CString Pin
Jose Lamas Rios17-Aug-05 4:50
Jose Lamas Rios17-Aug-05 4:50 
GeneralRe: HexEncoder class to CString Pin
Member 207257819-Aug-05 4:56
Member 207257819-Aug-05 4:56 
GeneralToolbar Pin
BicycleTheif13-Aug-05 3:07
BicycleTheif13-Aug-05 3:07 
Generalproble with hooks Pin
gamitech13-Aug-05 2:18
gamitech13-Aug-05 2:18 
Generaltopic for project Pin
V.G13-Aug-05 2:15
V.G13-Aug-05 2:15 
GeneralRe: topic for project Pin
John R. Shaw13-Aug-05 21:37
John R. Shaw13-Aug-05 21:37 
GeneralRe: topic for project Pin
V.G14-Aug-05 3:46
V.G14-Aug-05 3:46 

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.