|
-
December 31st, 2003, 07:20 AM
#1
BSTR*
Hello,
I'm allocating a BSTR* like that:
//-------------------------------------------------------------
BSTR* bstr
*bstr = SysAllocStringByteLen(sStlStr.c_str(),(unsigned int)sStlStr.length());
//sStlStr is std::string holding a string
//----------------------------------------------------------------
now when I look at the bstr at the debugger, that's what I see something that look like that (that's only part of the string, this is a very long one):
㔷㔮䐼呅䥁卌‽‧***************?‧癮㴠✠‧慢敳灟捲㴠✠‧慶畬‽ㄧ㈱㤬㜸‧潣瑳㴠✠‧潣瑳损杮灟湣
this bstr* is an out parameter for and the function is actually called by a VB client, the VB get this BSTR* as a string of ?
(pleny of them)
My question: how can I see the bstr* normally (with the same value as the stl::string)
I must use bstr* because as I said this code is part of a C++ function that is called from a VB client....
thanks
avi
Last edited by avi123; December 31st, 2003 at 07:25 AM.
-
December 31st, 2003, 12:12 PM
#2
A BSTR is Unicode while std::string is ANSI. Check the FAQ to see how you convert between them.
Get this small utility to do basic syntax highlighting in vBulletin forums (like Codeguru) easily.
Supports C++ and VB out of the box, but can be configured for other languages.
-
December 31st, 2003, 01:03 PM
#3
turn on the option to display unicode strings in the VC options should be under the debugger options, though I'm not sure that really is your problem. But just a heads up for debugging and displaying unicode strings.
-
January 1st, 2004, 01:27 AM
#4
I don't find this option
can you pls tell me where is it exactly?
thanks
-
January 1st, 2004, 01:34 PM
#5
Originally posted by avi123
I don't find this option
can you pls tell me where is it exactly?
thanks
From the "Tools" menu select "Options", go to the "Debug" property page and check "Display unicode strings".
-
January 1st, 2004, 06:37 PM
#6
Originally posted by Mick
turn on the option to display unicode strings in the VC options should be under the debugger options, though I'm not sure that really is your problem. But just a heads up for debugging and displaying unicode strings.
He must have it enabled already, otherwise he wouldn't have gotten the "㔷㔮䐼呅䥁卌‽‧***************?‧癮㴠✠‧慢敳灟捲㴠✠‧慶畬‽ㄧ㈱㤬㜸‧潣瑳㴠✠‧潣瑳损杮灟湣
" string.
Anyways, avi123, you have to convert from ANSI to Unicode, there is no other way. The line "SysAllocStringByteLen(sStlStr.c_str(),(unsigned int)sStlStr.length());" is way wrong and should be replaced by the real conversion.
Get this small utility to do basic syntax highlighting in vBulletin forums (like Codeguru) easily.
Supports C++ and VB out of the box, but can be configured for other languages.
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
|