Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Noob question about parsing a BSTR

Reply
Thread Tools

Noob question about parsing a BSTR

 
 
joseph_mueller@yahoo.com
Guest
Posts: n/a
 
      05-11-2006
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?

 
Reply With Quote
 
 
 
 
Victor Bazarov
Guest
Posts: n/a
 
      05-11-2006
http://www.velocityreviews.com/forums/(E-Mail Removed) 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


 
Reply With Quote
 
 
 
 
mlimber
Guest
Posts: n/a
 
      05-11-2006
(E-Mail Removed) 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

 
Reply With Quote
 
Phlip
Guest
Posts: n/a
 
      05-11-2006
(E-Mail Removed) 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!!!
 
Reply With Quote
 
Marcus Kwok
Guest
Posts: n/a
 
      05-11-2006
(E-Mail Removed) 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Here a noob, there a noob.... JimDoire MCSE 0 04-10-2008 07:23 PM
Ansi BSTR from dll, how to obtain in ASP.NET Edwin Knoppert ASP .Net 0 12-07-2005 04:33 PM
BSTR and a LPOLESTR Chris C++ 1 02-09-2005 01:39 PM
char (oder bstr) aufsplitten =?ISO-8859-1?Q?Andr=E9?= C++ 1 01-09-2004 08:47 AM
convert BSTR to a long tojo C++ 3 09-01-2003 02:16 PM



Advertisments