By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,144 Members | 1,250 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,144 IT Pros & Developers. It's quick & easy.

quick BSTR question

P: n/a
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)

Aug 30 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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

--
Kind regards,
Bruno.
br**********************@hotmail.com
Remove only "_nos_pam"

Aug 30 '06 #2

P: n/a
Ray
Lucy Ludmiller wrote:
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 :)

Aug 30 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.