Click to See Complete Forum and Search --> : Unpacking mixed unicode and byte data


September 24th, 1999, 07:43 AM
My VB app receives a Winsock msg from an OS/2 machine, containing 8 bytes of binary data and a 100 byte message. I can convert the character data to unicode with Strconv, but I can't seem to unload the return code bytes into any VB data type. Code fragment:



' get the socket message
WinsockClient.GetData strData
' Convert and unpack the message header
uniString = StrConv(strData, vbUnicode)
string = mid(uniString, 9, 100) ' An ascii msg, converts fine

integer = mid(uniString, 1, 1) ' doesn't work, before or after Unicode conversion





Any suggestions?

Thanks

Ravi Kiran
September 25th, 1999, 12:15 AM
Use Asc or AscW as the case may be

Dim i as integer
i = AscW(mid$(uniString, 1, 1))


RK