CodeGuru Forums -
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic Newsletters VB Forums Developer.com


Newest CodeGuru.com Articles:

  • ADO.NET Data Services in the .NET Framework
  • Visual C++ Programming: What's new for MFC library in VC++ 2010?
  • Microsoft Visual Studio LightSwitch and What It Can Do For You
  • Displaying Files and Folders in a GridView

  • Search CodeGuru:
     



    Go Back   CodeGuru Forums > Visual C++ & C++ Programming > Visual C++ Programming
    FAQ Members List Calendar Search Today's Posts Mark Forums Read

    Visual C++ Programming Ask questions about Windows programming with Visual C++ and help others by answering their questions.

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1    
    Old May 19th, 2009, 06:49 AM
    vjshankwar vjshankwar is offline
    Member +
     
    Join Date: Jan 2008
    Location: India
    Posts: 600
    vjshankwar is on a distinguished road (10+)
    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
    Reply With Quote
      #2    
    Old May 19th, 2009, 07:00 AM
    j66st j66st is offline
    Member
     
    Join Date: May 2005
    Location: Netherlands
    Posts: 187
    j66st is on a distinguished road (40+)
    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.
    Reply With Quote
    Reply

    Bookmarks
    Go Back   CodeGuru Forums > Visual C++ & C++ Programming > Visual C++ Programming


    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 11:07 PM.



    Acceptable Use Policy

    Internet.com
    The Network for Technology Professionals

    Search:

    About Internet.com

    Legal Notices, Licensing, Permissions, Privacy Policy.
    Advertise | Newsletters | E-mail Offers


    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.