|
-
Jul 26th, 2014, 11:01 AM
#1
Thread Starter
Member
Need Help Parsing data from Winsock
I am reading the data in a string now i want loop through each char if chr equals to Chr(&h Anything) then the next two bytes will be the length of the string in network byte order how should i read all the strings to an array ?
This is what i have tried
Private Function SomeFunction(ChrToLookFor As String,data As String) As String()
On Error Resume Next
Dim i As Integer, result() As String, index As Integer
For i = 1 To Len(data)
If Mid(data, i, 1) = ChrToLookFor Then
ReDim Preserve result(index) As String
result(index) = Mid$(data, i + 3, Asc(Mid$(data, i + 1, 1)) * 256 + Asc(Mid$(data, i + 2, 1)))
i = i + 3 + Asc(Mid$(data, i + 1, 1)) * 256 + Asc(Mid$(data, i + 2, 1))
index = index + 1
End If
Next
SomeFunction = result
End Function
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|