Solved

Posted on 2004-09-15
877 Views
I need to know how to parse and manipulate the results of BinaryRead obtained like so:

ByteCount            = Request.TotalBytes

I need to convert BinaryBuffer into a string, manipulate it, and then convert it back into a format in which i can do:

Response.BinaryWrite(MyModifiedBinaryBuffer)

Any ideas?
0
Question by:SweatCoder
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
• 2

LVL 15

Accepted Solution

deighc earned 500 total points
ID: 12072923
Try these functions. To use:

------------------------------------------------------------------------------------------------

Function RSBinaryToString(xBinary)
Dim Binary
'MultiByte data must be converted To VT_UI1 | VT_ARRAY first.
If vartype(xBinary)=8 Then Binary = MultiByteToBinary(xBinary) Else Binary = xBinary

Dim RS, LBinary
LBinary = LenB(Binary)

If LBinary>0 Then
RS.Open
RS("mBinary").AppendChunk Binary
RS.Update
RSBinaryToString = RS("mBinary")
Else
RSBinaryToString = ""
End If
End Function

Function MultiByteToBinary(MultiByte)
Dim RS, LMultiByte, Binary
LMultiByte = LenB(MultiByte)
If LMultiByte>0 Then
RS.Open
RS("mBinary").AppendChunk MultiByte & ChrB(0)
RS.Update
Binary = RS("mBinary").GetChunk(LMultiByte)
End If
MultiByteToBinary = Binary
End Function
0

LVL 15

Expert Comment

ID: 12072932
.... note that this just leaves you with a string - not a binary stream. You could use Response.write to output the result to the browser.
0

LVL 11

Author Comment

ID: 12075479
i posted this late last night and, as expected, didn't get an immediate response, so i ended up having success doing it this way:

' Convert the binary data to ASCII
FOR counter = 1 TO LENB(BinaryBuffer)
PostedData = PostedData & Chr(AscB(MidB(BinaryBuffer, counter,1)))
NEXT

. . .but i'm wondering if there's a way to do this without a FOR loop that traverses over every character in the binary stream. just convert the binary stream to a text stream without looping through, just for efficiency.
0

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
###### Suggested Courses
Course of the Month6 days, 22 hours left to enroll