|
-
Nov 20th, 2000, 11:33 PM
#1
Thread Starter
Lively Member
hello,
i've tried to use winsock over API codes and got it working, and when ever data is receive i will catch in Buffer(1000) as Bytes. the problem is that even though the data received did not fill up 1000 bytes the length of the encoded text is still 1000 bytes. How can i reduce it back to it's actual size? for example: "PING :irc.webmaster.com" to it's actual length as 23 characters?
-
Nov 21st, 2000, 06:46 AM
#2
Try storing the length in an integer if you want to keep it in that way.
-
Nov 21st, 2000, 09:32 AM
#3
Frenzied Member
ehhrrmm... You have it in a byte array and want to change the dimensions?
Code:
'like
Dim b() as Byte '?
then try (I haven't tried it yet)
Redim Preserve b(uBound(b))
Have fun!
Edit...
Ah sh*t!
I just realized it was really dumb i was trying to do 
'cause Ubound gives the upper bound of the array, not the upper bound of the filled contents... hmm.. sorry mate!
[Edited by Jop on 11-21-2000 at 09:34 AM]
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Nov 21st, 2000, 10:00 AM
#4
If the api returns ANSI text you could use this:
sText = StrConv(Buffer, vbUnicode)
sText = Left(sText, InStr(sText, Chr(0)) - 1)
And if the api returns Unicode you could do it like this:
sText = Buffer
sText = Left(sText, InStr(sText, Chr(0)) - 1)
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
|