Click here to Skip to main content
15,888,610 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: here is my algorithm. Pin
David Crow10-Nov-07 4:05
David Crow10-Nov-07 4:05 
GeneralRe: here is my algorithm. Pin
George_George10-Nov-07 4:15
George_George10-Nov-07 4:15 
QuestionCString to TCHAR & TCHAR to CString Pin
Paulraj G6-Nov-07 20:29
Paulraj G6-Nov-07 20:29 
AnswerRe: CString to TCHAR & TCHAR to CString Pin
Cedric Moonen6-Nov-07 20:43
Cedric Moonen6-Nov-07 20:43 
GeneralRe: CString to TCHAR & TCHAR to CString Pin
Paulraj G6-Nov-07 20:59
Paulraj G6-Nov-07 20:59 
GeneralRe: CString to TCHAR & TCHAR to CString Pin
Cedric Moonen6-Nov-07 21:05
Cedric Moonen6-Nov-07 21:05 
GeneralRe: CString to TCHAR & TCHAR to CString Pin
CPallini6-Nov-07 21:14
mveCPallini6-Nov-07 21:14 
AnswerRe: CString to TCHAR; TCHAR to CString [incorrect] [modified] Pin
Llasus6-Nov-07 21:06
Llasus6-Nov-07 21:06 
Just a quick sample though I think it might be on a brute-force approach. I had problems with TCHAR though, it has some trash characters at the end.

TCHAR* tchar;<br />
CString message("Hello there");<br />
<br />
int temp = message.GetLength()*2; //multiply by 2 because of the CString format<br />
tchar =(TCHAR*)malloc(temp+1); //add 1 for the NULL at the end: but doesn't work<br />
memset(tchar, NULL, temp+1);<br />
memcpy(tchar, message, temp); //copy; now we have the TCHAR<br />
<br />
//assign the tchar to the CString<br />
CString messageback(tchar, temp/2); //divide by 2 since it's the actual number of characters<br />
free(tchar);


Sorry but still a problem with TCHAR's variable as there are "trash" characters on the end. Maybe others can help. Smile | :)
Read this article here

-- modified at 18:50 Wednesday 7th November, 2007

ouch! sorry bout that. admittedly, I did not really took that much attention to the article. comments noted. lesson learned. Dead | X| Blush | :O
GeneralHonestly Pin
CPallini6-Nov-07 21:28
mveCPallini6-Nov-07 21:28 
GeneralRe: CString to TCHAR &amp;amp; TCHAR to CString Pin
Cedric Moonen6-Nov-07 21:34
Cedric Moonen6-Nov-07 21:34 
GeneralRe: CString to TCHAR &amp;amp; TCHAR to CString Pin
Raj Prathap7-Nov-07 0:09
Raj Prathap7-Nov-07 0:09 
GeneralRe: CString to TCHAR &amp;amp; TCHAR to CString Pin
toxcct7-Nov-07 0:30
toxcct7-Nov-07 0:30 
AnswerRe: CString to TCHAR & TCHAR to CString Pin
toxcct7-Nov-07 0:28
toxcct7-Nov-07 0:28 
QuestionWEB SERVER IN VC++ [modified] Pin
kansagous6-Nov-07 19:33
kansagous6-Nov-07 19:33 
AnswerRe: WEB SERVER IN VC++ Pin
shpid3r8-Nov-07 10:14
shpid3r8-Nov-07 10:14 
QuestionHollow Brush Pin
nitin36-Nov-07 19:24
nitin36-Nov-07 19:24 
AnswerRe: Hollow Brush Pin
Neo Andreson6-Nov-07 21:36
Neo Andreson6-Nov-07 21:36 
GeneralRe: Hollow Brush Pin
nitin36-Nov-07 22:08
nitin36-Nov-07 22:08 
GeneralRe: Hollow Brush [modified] Pin
Neo Andreson6-Nov-07 22:28
Neo Andreson6-Nov-07 22:28 
AnswerRe: Hollow Brush Pin
Mark Salsbery7-Nov-07 7:54
Mark Salsbery7-Nov-07 7:54 
Questionmenu on a button click event Pin
neha.agarwal276-Nov-07 17:55
neha.agarwal276-Nov-07 17:55 
QuestionRe: menu on a button click event Pin
Hamid_RT6-Nov-07 18:55
Hamid_RT6-Nov-07 18:55 
AnswerRe: menu on a button click event Pin
Prasann Mayekar6-Nov-07 21:45
Prasann Mayekar6-Nov-07 21:45 
Questionhow can i set message map for dynamic created CEdit [modified] Pin
mwolf1226-Nov-07 16:46
mwolf1226-Nov-07 16:46 
AnswerRe: how can i set message map for dynamic created CEdit Pin
Hamid_RT6-Nov-07 18:57
Hamid_RT6-Nov-07 18:57 

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.