-
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?
-
Try storing the length in an integer if you want to keep it in that way.
-
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]
-
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)