quick BSTR question

  • Thread starter Thread starter Lucy Ludmiller
  • Start date Start date
L

Lucy Ludmiller

How can I write a function like this:

BSTR Greeting(BSTR name)
{
//return "Good Morning : " + name ;
}

In short I'm looking for a quick tutorial on using BSTR - Google is not
bringing up anything consise enough (I'm not particularly interested in
the history of BSTR and the differences between string types etc ...
just need to get down to the "nuts and bolts" of using BSTRs)
 
How can I write a function like this:
BSTR Greeting(BSTR name)
{
//return "Good Morning : " + name ;
}

In short I'm looking for a quick tutorial on using BSTR - Google is not
bringing up anything consise enough (I'm not particularly interested in
the history of BSTR and the differences between string types etc ...
just need to get down to the "nuts and bolts" of using BSTRs)

You can use SysAllocString to allocate BSTRs
You have to use SysFreeString to deallocate them afterwards.

If you google around for tutorials that mention SysAllocString, you should
find a number of articles that tell you how to use BSTRs
 
Lucy said:
How can I write a function like this:

BSTR Greeting(BSTR name)
{
//return "Good Morning : " + name ;
}

In short I'm looking for a quick tutorial on using BSTR - Google is not
bringing up anything consise enough (I'm not particularly interested in
the history of BSTR and the differences between string types etc ...
just need to get down to the "nuts and bolts" of using BSTRs)

Well the thing is that it's easier for you to understand BSTR if you
understand the "differences between string types etc."

But search for _bstr_t, it makes using BSTR *that* much easier. Of
course this being C++ you can't expect it to be as simple as VB, but
close enough :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top