Noob question about parsing a BSTR

Discussion in 'C++' started by joseph_mueller@yahoo.com, May 11, 2006.

  1. Guest

    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, 2006
    #1
    1. Advertising

  2. 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
     
    Victor Bazarov, May 11, 2006
    #2
    1. Advertising

  3. mlimber Guest

    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-lite/how-to-post.html#faq-5.9

    Cheers! --M
     
    mlimber, May 11, 2006
    #3
  4. Phlip Guest

    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!!!
     
    Phlip, May 11, 2006
    #4
  5. Marcus Kwok Guest

    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
     
    Marcus Kwok, May 11, 2006
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Edwin Knoppert

    Ansi BSTR from dll, how to obtain in ASP.NET

    Edwin Knoppert, Dec 7, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    438
    Edwin Knoppert
    Dec 7, 2005
  2. tojo

    convert BSTR to a long

    tojo, Aug 29, 2003, in forum: C++
    Replies:
    3
    Views:
    3,789
    Tom Lee
    Sep 1, 2003
  3. =?ISO-8859-1?Q?Andr=E9?=

    char (oder bstr) aufsplitten

    =?ISO-8859-1?Q?Andr=E9?=, Jan 9, 2004, in forum: C++
    Replies:
    1
    Views:
    699
    Karl Heinz Buchegger
    Jan 9, 2004
  4. Chris

    BSTR and a LPOLESTR

    Chris, Feb 9, 2005, in forum: C++
    Replies:
    1
    Views:
    6,035
    Unforgiven
    Feb 9, 2005
  5. Matt Helm
    Replies:
    5
    Views:
    1,620
    Matt Helm
    Feb 6, 2006
Loading...

Share This Page