Samar I guess it worked the way you suggested. Thanks a bunch.
But it seems to give same value(short*) for bstr(=102):

BSTR bstr = SysAllocString(L"India");
Or
BSTR bstr= SysAllocString(L"Ind");

Any suggestion?

-----Original Message-----
From: Bhushan Khanal [mailto:[EMAIL PROTECTED]] 
Sent: Friday, March 08, 2002 7:30 PM
To: '[EMAIL PROTECTED]'
Subject: RE: SysAllocString

Be careful when using rawBuffer(). The documentation says that its not
always guranteed to be null terminated ;)

Bhushan

-----Original Message-----
From: Samar Lotia [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 08, 2002 4:13 PM
To: '[EMAIL PROTECTED]'
Subject: RE: SysAllocString


Since you are working on windows, an XMLCh * is exactly the same as a
wchar_t * which is the same as a OLECHAR * which is the same as a BSTR.

You can use

XMLCh * p = XMLnode.getNodeName().rawBuffer();
BSTR bstr = SysAllocString(p);

-----Original Message-----
From: John Utz [mailto:[EMAIL PROTECTED]]
Sent: Friday, March 08, 2002 18:06
To: [EMAIL PROTECTED]
Subject: RE: SysAllocString


i assume you are doing this in Visual DevilStudio.

open up the documentation and search for wctombs() and it's brethren

there is a bunch of functions that convert char strings to wchar strings
and vice versa....

On Fri, 8 Mar 2002, Bavishi, Pankaj wrote:

> I get what you are saying. But in my code, I don't know what "Hello" is?
> I mean I have :
> 
> Char* vna2 = ((XMLNode.getNodeName()).transcode());
> BSTR bstr= SysAllocString(vna2)....doesn't work..
> 
> I am not in a position to print the string and then put it in SysAlloc
> function.
> 
> 
> -----Original Message-----
> From: John Utz [mailto:[EMAIL PROTECTED]] 
> Sent: Friday, March 08, 2002 6:32 PM
> To: [EMAIL PROTECTED]
> Subject: Re: SysAllocString
> 
> this is because the L makes it a wide string
> 
> On Fri, 8 Mar 2002, Bavishi, Pankaj wrote:
> 
> > When I use:
> > BSTR bstr=SysAllocString(L"Hello");
> > It works fine
> > But I can't do:
> > Char* str ="Hello";
> 
> WCHAR* wstr = L"Hello";
> 
> > BSTR bstr=SysAllocString(str);
> > 
> > Why? Could you please suggest me the Solution.
> > This is the process to convert DOMString to BSTR>
> > Thanks
> > pankaj
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to