locked
Conversation problem RRS feed

  • Question

  • Dear all,

    Is that possible to convert from [1]CString to const char *, [2] TCHAR to const char * when unicode is set ?

    Could you share any sample codes.. I searched for lot - but got result only for unicode not set....

    Thursday, September 20, 2012 9:10 AM

Answers

  • >Is that possible to convert from [1]CString to const char *, [2] TCHAR to const char * when unicode is set ?

    Yes - but bear in mind that converting from Unicode to ANSI/MBCS is a
    lossy conversion - any characters not in the code page will be lost.

    See "ATL and MFC String Conversion Macros"
    http://msdn.microsoft.com/en-us/library/87zae4a3(v=vs.90).aspx

    Dave

    Thursday, September 20, 2012 9:34 AM

All replies

  • >Is that possible to convert from [1]CString to const char *, [2] TCHAR to const char * when unicode is set ?

    Yes - but bear in mind that converting from Unicode to ANSI/MBCS is a
    lossy conversion - any characters not in the code page will be lost.

    See "ATL and MFC String Conversion Macros"
    http://msdn.microsoft.com/en-us/library/87zae4a3(v=vs.90).aspx

    Dave

    Thursday, September 20, 2012 9:34 AM
  • Sample codes will help a lot
    Friday, September 21, 2012 5:52 AM
  • >Sample codes will help a lot

    Follow the link, it has examples.

    Dave

    Friday, September 21, 2012 7:16 AM