|
-
May 18th, 1999, 11:00 AM
#1
BSTR to CString
When i try to read a BSTR in a COleVariant with
CString Cs;
Cs.Format("%s", Variant.bstrVal);
my Cs contains just the first character of the string. Could you explain me why and what is the good methode to do this !
---------------------------------------------
Laurent BERNARD
Ingénieur Développement - Logiciel Visilog
NOESIS
6, rue de la réunion
91940 Les Ulis
E-mail : [email protected]
Tél.: 01 64 86 78 50 poste 290
------------------------------------------------
-
May 18th, 1999, 11:45 AM
#2
Re: BSTR to CString
CString Cs = Variant.bstVal;
--michael
-
May 18th, 1999, 11:48 AM
#3
Re: BSTR to CString
1. use _bstr_t.
It has a char* operator.
So, u can use it like this :
_bstr_t my_bstr;
CString s1 = (char*)my_bstr;
Or
2. You can try this:
Variant.vt = VT_BSTR;
CString s2 = V_BSTRT(&Variant);
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|