Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CString -> WCHAR ( MS VC++ 6.0 with MFC )

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hy everybody,

I've got a little problem:
I'd like to use a funktion wich needs as input parameter a WCHAR but all i have is a CString !
Is there anybody out there who can help me ??

Regards and thanks for any answer,
SAM
 
When directive _UNICODE defined CString contain WCHAR* string. If isn't defined CString contain char*. In this case you can use macros A2W():

CString str("Test");
WCHAR buf[1024]; // You can dynamically allocate memory
// by operator new.
USES_CONVERSION;
wcscpy(buf, A2W((LPCSTR)str));

for more information about this macroses you can search "USES_CONVERSION" in MSDN library.

I hope that this data will be helpful for you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top