Click here to Skip to main content
15,909,656 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Dialog help needed Pin
BlitzPackage12-Nov-06 17:55
BlitzPackage12-Nov-06 17:55 
GeneralRe: Dialog help needed Pin
locoone12-Nov-06 17:57
locoone12-Nov-06 17:57 
AnswerRe: Dialog help needed Pin
BlitzPackage12-Nov-06 15:04
BlitzPackage12-Nov-06 15:04 
Questionmshflexgrid problem Pin
Tarek Jabri12-Nov-06 3:22
Tarek Jabri12-Nov-06 3:22 
AnswerRe: mshflexgrid problem Pin
S Douglas13-Nov-06 21:59
professionalS Douglas13-Nov-06 21:59 
QuestionMalloc fails...why? Pin
damir_tk12-Nov-06 2:30
damir_tk12-Nov-06 2:30 
AnswerRe: Malloc fails...why? Pin
Taka Muraoka12-Nov-06 2:36
Taka Muraoka12-Nov-06 2:36 
AnswerRe: Malloc fails...why? Pin
Waldermort12-Nov-06 4:22
Waldermort12-Nov-06 4:22 
First, why are you not using new and delete? and second, why are you calling free() on what you already know to be a NULL pointer?

Now for your problem, GetCurrentDirectory() is returning the length required excluding the terminating NULL character, but you are not adding this when you call malloc. so your second call will read the string and not write the NULL. Later when you call wstrlen(), it is reading the string uo until the first NULL it finds, which could be anywhere. Therefore may return an insanly high value. When used in malloc, it returns NULL because there is not enough memory.

The problem has nothing to do with sizeof(TCHAR) Poke tongue | ;-P
GeneralRe: Malloc fails...why? Pin
damir_tk12-Nov-06 9:50
damir_tk12-Nov-06 9:50 
AnswerRe: Malloc fails...why? Pin
Mark Salsbery12-Nov-06 8:33
Mark Salsbery12-Nov-06 8:33 
GeneralRe: Malloc fails...why? Pin
damir_tk12-Nov-06 9:55
damir_tk12-Nov-06 9:55 
GeneralRe: Malloc fails...why? Pin
Mark Salsbery12-Nov-06 10:27
Mark Salsbery12-Nov-06 10:27 
GeneralRe: Malloc fails...why? Pin
damir_tk12-Nov-06 10:42
damir_tk12-Nov-06 10:42 
Questionproblem with colour the radio & check box in property page [modified] Pin
vikas amin12-Nov-06 0:54
vikas amin12-Nov-06 0:54 
AnswerRe: problem with colour the radio & check box in property page Pin
Rajesh R Subramanian12-Nov-06 19:39
professionalRajesh R Subramanian12-Nov-06 19:39 
GeneralRe: problem with colour the radio & check box in property page Pin
vikas amin12-Nov-06 20:21
vikas amin12-Nov-06 20:21 
GeneralRe: problem with colour the radio & check box in property page Pin
Rajesh R Subramanian12-Nov-06 20:43
professionalRajesh R Subramanian12-Nov-06 20:43 
GeneralRe: problem with colour the radio & check box in property page Pin
vikas amin12-Nov-06 21:14
vikas amin12-Nov-06 21:14 
Question"How can I pass jbyte * from C++ to VB" Pin
Orchid8512-Nov-06 0:46
Orchid8512-Nov-06 0:46 
Questioninterface in background Pin
Johpoke12-Nov-06 0:42
Johpoke12-Nov-06 0:42 
AnswerRe: interface in background Pin
Sceptic Mole12-Nov-06 6:16
Sceptic Mole12-Nov-06 6:16 
AnswerRe: interface in background Pin
Mike_V12-Nov-06 15:10
Mike_V12-Nov-06 15:10 
GeneralRe: interface in background Pin
Johpoke13-Nov-06 8:17
Johpoke13-Nov-06 8:17 
GeneralRe: interface in background Pin
Mike_V13-Nov-06 8:43
Mike_V13-Nov-06 8:43 
GeneralRe: interface in background Pin
Johpoke13-Nov-06 8:51
Johpoke13-Nov-06 8:51 

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.