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

C / C++ / MFC

 
AnswerRe: How I can convert CString variable into char * ? Pin
prasad_som14-Dec-06 23:54
prasad_som14-Dec-06 23:54 
GeneralRe: How I can convert CString variable into char * ? Pin
toxcct15-Dec-06 1:55
toxcct15-Dec-06 1:55 
GeneralRe: How I can convert CString variable into char * ? Pin
prasad_som15-Dec-06 2:13
prasad_som15-Dec-06 2:13 
GeneralRe: How I can convert CString variable into char * ? Pin
David Crow15-Dec-06 3:51
David Crow15-Dec-06 3:51 
AnswerRe: How I can convert CString variable into char * ? Pin
prasad_som15-Dec-06 6:40
prasad_som15-Dec-06 6:40 
AnswerRe: How I can convert CString variable into char * ? Pin
CPallini14-Dec-06 23:57
mveCPallini14-Dec-06 23:57 
AnswerRe: How I can convert CString variable into char * ? Pin
kakan15-Dec-06 0:59
professionalkakan15-Dec-06 0:59 
GeneralRe: How I can convert CString variable into char * ? Pin
toxcct15-Dec-06 2:03
toxcct15-Dec-06 2:03 
as you said, it's not "completely safe" (actually, not safe at all... lol).

first of all, you use C-Style cast, which is deprecated for using static_cast<>()
moreover, by using (char*) after that, you remove the constness of the string return, which is very very bad ! if you have to modify a CString string, use GetBuffer(), or copy its content into your own modifiable char array.
at last, if you have to deal with the Unicode/Ansi conversion, you should use T2A()-like (in your case) macros...


Don't know where to start ?
Refer the Forums Guidelines and ask a friend

[VisualCalc 3.0][Flags Beginner's Guide]

GeneralRe: How I can convert CString variable into char * ? Pin
kakan15-Dec-06 2:15
professionalkakan15-Dec-06 2:15 
GeneralRe: How I can convert CString variable into char * ? Pin
CPallini15-Dec-06 2:22
mveCPallini15-Dec-06 2:22 
GeneralRe: How I can convert CString variable into char * ? Pin
kakan15-Dec-06 2:25
professionalkakan15-Dec-06 2:25 
AnswerRe: How I can convert CString variable into char * ? Pin
Rage15-Dec-06 1:32
professionalRage15-Dec-06 1:32 
AnswerRe: How I can convert CString variable into char * ? Pin
Hamid_RT15-Dec-06 18:17
Hamid_RT15-Dec-06 18:17 
Questionproblem with list control. Pin
priyank_ldce14-Dec-06 23:37
priyank_ldce14-Dec-06 23:37 
AnswerRe: problem with list control. Pin
prasad_som14-Dec-06 23:44
prasad_som14-Dec-06 23:44 
GeneralRe: problem with list control. Pin
priyank_ldce15-Dec-06 0:02
priyank_ldce15-Dec-06 0:02 
QuestionVariable not shared between dlls... Pin
Shy Agam14-Dec-06 23:35
Shy Agam14-Dec-06 23:35 
AnswerRe: Variable not shared between dlls... Pin
pnkj15-Dec-06 2:06
pnkj15-Dec-06 2:06 
GeneralRe: Variable not shared between dlls... [modified] Pin
Shy Agam15-Dec-06 3:40
Shy Agam15-Dec-06 3:40 
AnswerRe: Variable not shared between dlls... Pin
Michael Dunn15-Dec-06 11:58
sitebuilderMichael Dunn15-Dec-06 11:58 
QuestionCDialog Pin
Bravoone_200614-Dec-06 23:26
Bravoone_200614-Dec-06 23:26 
AnswerRe: CDialog Pin
Rage15-Dec-06 1:37
professionalRage15-Dec-06 1:37 
AnswerRe: CDialog Pin
Hamid_RT15-Dec-06 2:38
Hamid_RT15-Dec-06 2:38 
QuestionRe: CDialog Pin
David Crow15-Dec-06 3:59
David Crow15-Dec-06 3:59 
NewsRe: CDialog Pin
Bravoone_200617-Dec-06 22:20
Bravoone_200617-Dec-06 22:20 

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.