473,378 Members | 1,436 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

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 5340
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Chris | last post by:
I am not sure if this is the right newsgroup. But does anyone know what is the difference between a BSTR and a LPOLESTR? The only thing I could find out is that the advantage of taking BSTR...
7
by: Gilad Walden | last post by:
I use C# in .NET framework. I have an ActiveX implemented in C++ that has a COM interface method that gets as it’s out parameter a BSTR* . The interop translates this BSTR* into C# string. From...
8
by: Michael Tissington | last post by:
I have a C++ function in a DLL of the form BSTR WINAPI DoSomeWork(LPCSTR szConnection, LPCSTR szGUID) I use SysAllocStringByteLen to return a BSTR. For the most part this works accept when...
5
by: bluter | last post by:
We have server components which were created by a third party and compiled in VC++5 (sp3). They run fine on NT4 and 2000, however during testing of our migration to Server 2003, these components...
3
by: Egbert Nierop \(MVP for IIS\) | last post by:
Hi, Out of curiousity, I sometimes look at the produced assembly after compilation in release mode. What you often see, is that CPP, always fully addresses registers to copy values from a to...
37
by: Egbert Nierop \(MVP for IIS\) | last post by:
In win32 mode, a BSTR was UINT length prefixed and terminated exactly by a zero char. So if you allocated "Hello World" that would allocate 28 bytes. In x64 and (IA64 as well) it would become...
42
by: Holger | last post by:
Hi guys Tried searching for a solution to this, but the error message is so generic, that I could not get any meaningfull results. Anyways - errormessage:...
0
by: sujk2k | last post by:
Hello, my problem is related to marshalling of C data type 'BSTR from the .NET code steps: 1. I have a c# program which calls one function from a VC++ dll file as follows: ...
2
by: mzdude | last post by:
I need to interface with a windows DLL that has the following signature extern "C" void Foo( BSTR in, BSTR *out ) Code so far Traceback (most recent call last): File "<pyshell#14>", line...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.