469,898 Members | 1,611 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,898 developers. It's quick & easy.

Noob question about parsing a BSTR

I have a BSTR something like this

firstHalf.secondHalf

I want to parse this string using the "." as the delimeter, so I will
end up with two different BSTRs, one for the stuff before the "." and
one for the stuff after it. How can I do this?

May 11 '06 #1
4 5094
jo************@yahoo.com wrote:
I have a BSTR
What's a "BSTR"?
something like this

firstHalf.secondHalf

I want to parse this string using the "." as the delimeter, so I will
end up with two different BSTRs, one for the stuff before the "." and
one for the stuff after it. How can I do this?


Since "BSTR" is not defined in C++, you might want to specify first
what "BSTR" is. If it's some kind of string, then you should be using
string manipulation functions to (a) search the string for '.' and (b)
extract a substring from the beginning of it to the '.' position (not
including the '.') or to the end if '.' is not found, and if '.' is
found, then also extract a substring from after the '.' to the end.
What functions to use and how to use them depends on what "BSTR" is.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
May 11 '06 #2
jo************@yahoo.com wrote:
I have a BSTR something like this

firstHalf.secondHalf

I want to parse this string using the "." as the delimeter, so I will
end up with two different BSTRs, one for the stuff before the "." and
one for the stuff after it. How can I do this?


BSTRs are part of a non-standard library provided by Microsoft. If you
can rephrase this question in the terms of the standard C++ language
and libraries, we can help you here. If not, you should ask in a
Microsoft newsgroup. For details on what is on-topic here and for a
list of some other groups you could try, see this FAQ:

http://www.parashift.com/c++-faq-lit...t.html#faq-5.9

Cheers! --M

May 11 '06 #3
jo************@yahoo.com wrote:
I have a BSTR something like this

firstHalf.secondHalf

I want to parse this string using the "." as the delimeter, so I will
end up with two different BSTRs, one for the stuff before the "." and
one for the stuff after it. How can I do this?


<off-topic>
Put it into a _bstr_t. Then use strdup() to put it into a character string
buffer. Then...
</off-topic>

Use strtok(string, ".").

You will get the best answers about BSTR on a forum that covers COM
programming. This forum is only qualified to answer questions about C++
itself. For example, that forum might be able to hook you up with a Regexp
class that works with BSTRs directly, so you don't need all those
conversions. And use _bstr_t wherever possible...

--
Phlip
http://www.greencheese.us/ZeekLand <-- NOT a blog!!!
May 11 '06 #4
jo************@yahoo.com wrote:
I have a BSTR something like this

firstHalf.secondHalf

I want to parse this string using the "." as the delimeter, so I will
end up with two different BSTRs, one for the stuff before the "." and
one for the stuff after it. How can I do this?


I don't know anything of BSTR and I'm pretty sure it's not defined by
the C++ language. If you were using std::strings, you could look into
using string::find_first_of() (or one of its variants).

--
Marcus Kwok
Replace 'invalid' with 'net' to reply
May 11 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Chris | last post: by
7 posts views Thread by Gilad Walden | last post: by
8 posts views Thread by Michael Tissington | last post: by
3 posts views Thread by Egbert Nierop \(MVP for IIS\) | last post: by
37 posts views Thread by Egbert Nierop \(MVP for IIS\) | last post: by
2 posts views Thread by mzdude | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.