CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Guest

    Unpacking mixed unicode and byte data

    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


  2. #2
    Join Date
    May 1999
    Location
    Omika, Japan
    Posts
    729

    Re: Unpacking mixed unicode and byte data

    Use Asc or AscW as the case may be

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


    RK

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured