How to convert CString to WCHAR*?
-
Hi, I need to convert CString to WCHAR* but I don't know how. If you know how please tell me. Your comment will be a big help. Thank you.
-
Hi, I need to convert CString to WCHAR* but I don't know how. If you know how please tell me. Your comment will be a big help. Thank you.
If your app is UNICODE enabled then CString can be used at the place of WCHAR* by using its str.GetBuffer() function. If not then use MultiByteToWideChar() function to convert CString to WCHAR*
-
Hi, I need to convert CString to WCHAR* but I don't know how. If you know how please tell me. Your comment will be a big help. Thank you.
In addition to ccpptrain's reply... If your app is UNICODE enabled then CString has a casting operator so you can use the string anywhere a const WCHAR* is expected...without having to use GetBuffer(). Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
If your app is UNICODE enabled then CString can be used at the place of WCHAR* by using its str.GetBuffer() function. If not then use MultiByteToWideChar() function to convert CString to WCHAR*
Thank you very much to your reply. It was very helpful.
-
In addition to ccpptrain's reply... If your app is UNICODE enabled then CString has a casting operator so you can use the string anywhere a const WCHAR* is expected...without having to use GetBuffer(). Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
Thanks for the time. It helps a lot.
-
In addition to ccpptrain's reply... If your app is UNICODE enabled then CString has a casting operator so you can use the string anywhere a const WCHAR* is expected...without having to use GetBuffer(). Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
Mark Salsbery wrote:
.without having to use GetBuffer().
What! No
GetBuffer()
? :rolleyes: That sucks.Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP
-
Mark Salsbery wrote:
.without having to use GetBuffer().
What! No
GetBuffer()
? :rolleyes: That sucks.Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP
Hehe ;P
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
Mark Salsbery wrote:
.without having to use GetBuffer().
What! No
GetBuffer()
? :rolleyes: That sucks.Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP
Rajesh R Subramanian wrote:
What! No GetBuffer()? That sucks.
I know, thats really sucks,, but come handy somewhere!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
Never mind - my own stupidity is the source of every "problem" - Mixturecheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You/codeProject$$>
-
Rajesh R Subramanian wrote:
What! No GetBuffer()? That sucks.
I know, thats really sucks,, but come handy somewhere!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
Never mind - my own stupidity is the source of every "problem" - Mixturecheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You/codeProject$$>
ThatsAlok wrote:
but come handy somewhere!
Not the best thing to have handy while converting a CString to a
WCHAR*
though. :)Nobody can give you wiser advice than yourself. - Cicero .·´¯`·->Rajesh<-·´¯`·. Codeproject.com: Visual C++ MVP