CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2005
    Posts
    64

    UniCode Conversion problem

    Hi, I am converting an application to Unicode.

    It compiles successfully in UNICODE.
    but when I run, the output was something strange.

    In fact I am taking Input in a BSTR variable, and want to convert this in to
    tstring.
    tstring in my application I have defined as

    typedef basic_string<TCHAR> tstring;

    to convert BSTR in to tstring I used,

    BSTR bstrRtf;
    here bstrRtf , will contain the value, which the client will send.

    tstring strTest1 = W2T(bstrRtf);

    can u suggest, where I am wrong, and How can I rectify this..

    Regs

  2. #2
    Join Date
    Feb 2002
    Location
    Surrey, England
    Posts
    99

    Re: UniCode Conversion problem

    You could try using the _bstr_t class.

    Code:
    #include <comutil.h>
    
    ...
    _bstr_t bsTemp= bstrRtf;
    tstring strTest1 = (TCHAR*)(bsTemp);
    ...

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured