How do you TRACE() a BSTR??
-
Where Name is a BSTR: TRACE("\nFIELD[%d]: %s",j,(LPCTSTR)Name); or TRACE("\nFIELD[%d]: %s",j,Name); Both just print the first char?? Anders G
-
Where Name is a BSTR: TRACE("\nFIELD[%d]: %s",j,(LPCTSTR)Name); or TRACE("\nFIELD[%d]: %s",j,Name); Both just print the first char?? Anders G
i think this will do it: TRACE("%S", myBeaster);
image processing toolkits | batch image processing | blogging
-
i think this will do it: TRACE("%S", myBeaster);
image processing toolkits | batch image processing | blogging
It did! Thanks!! This basic stuff is slowly polluting our pure C++ world ;)
-
Where Name is a BSTR: TRACE("\nFIELD[%d]: %s",j,(LPCTSTR)Name); or TRACE("\nFIELD[%d]: %s",j,Name); Both just print the first char?? Anders G
a BSTR is a UTF-16 (or is it UCS2? can't remember) encoded string. This means that each character is a 2 byte word. The ASCII character set fits within a single byte of each word. As such, from a char* point of view, a BSTR is basically a string with a \0 character between every character. Hence you get only the first character.
-
Where Name is a BSTR: TRACE("\nFIELD[%d]: %s",j,(LPCTSTR)Name); or TRACE("\nFIELD[%d]: %s",j,Name); Both just print the first char?? Anders G
%S
will work as long as you are calling an ANSI trace function.%S
means "a string in the character set opposite of the current TCHAR character set". To make it work in all cases, use%ls
instead.--Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ Ford, what's this fish doing in my ear?
-
Where Name is a BSTR: TRACE("\nFIELD[%d]: %s",j,(LPCTSTR)Name); or TRACE("\nFIELD[%d]: %s",j,Name); Both just print the first char?? Anders G
Anders Gustafsson wrote:
Where Name is a BSTR: TRACE("\nFIELD[%d]: %s",j,(LPCTSTR)Name);
TRACE("\nFIELD[%d]: %s",j,(LPCTSTR)_bstr_t(Name));
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers, Alok Gupta Global Interface Table: An Easy Way to Marshal an Interface Pointer[new] VC Forum Q&A :- I/ IV Support CRY- Child Relief and You