• C

convert bstr to ASCII

i wrote aprogram in vb5 that use mscomm how i convert bstr
to ascii.
Who is Participating?
duneramConnect With a Mentor Commented:
I found some information that may prove to be helpful.

The first 4 bytes of a bstring contains the number of characters (not counting null terminator) in the ascii string.  This means if your string contained "Hello\0World"   the first 4 bytes would hold 11.   In our case it has an embedded NULL character...

There is more info at:  http://www.microsoft.com/oledev/olecom/article3.htm
It is titled "Article 3. Strings the OLE way" and the author is Bruce McKinney.

A c structure might look like:

    long length;
    char *text;
} bstr;

you should post this over in the VB section  http://www.experts-exchange.com/comp/lang/visualbasic/
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.