convert CString to const wchar_t *.
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: convert CString to const wchar_t *.

  1. #1
    Join Date
    Jan 2008
    Location
    India
    Posts
    780

    convert CString to const wchar_t *.

    Hi all please tell me how can i convert CString to const wchar_t *.

    thanks.
    IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH

  2. #2
    Join Date
    May 2005
    Location
    Netherlands
    Posts
    187

    Re: convert CString to const wchar_t *.

    If you compile in Unicode mode, your CStrings will be wide, and you can use the standard cast operator:

    Code:
    CString cs(L"Hello world");
    TCHAR szBuffer[200];
    _tcscpy(szBuffer, cs);
    In 8-bit MBCS mode you can declare a wide CString as CString<wchar_t>.

    If you have an 8-bit CString you can use the conversion macros USES_CONVERSION and A2W() to convert the contents to wide characters.

    Or use a _bstr_t variable, which is a dual-mode string.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center