Android Question Read raw bytes of a file

Michael Müller Anywhere

Member
Licensed User
Longtime User
Hello,
I need to transfer pictures to a VB6 Application via winsock (encrypted before).

With the wllknown methods I get a byte() Array that is UTF8 encodet.
How can I read the raw bytes of a file (Picture) and put it in a long string to transfer it?

Thank you!
 

DonManfred

Expert
Licensed User
Longtime User
Last edited:
Upvote 1

Michael Müller Anywhere

Member
Licensed User
Longtime User

Thank you Don!!!
This works. For all:

B4A-Side:
Dim data() As Byte = File.ReadBytes(path, filename)
Dim Bconv As ByteConverter
datastring = Bconv.HexFromBytes(data)

VB6 Code:
file_content = Hex2Ascii(input)

Function Hex2Ascii(Hcs As String) As String
Dim l As Long
Dim a As Long

    l = Len(Hcs)
    For a = 1 To l Step 2
        Hex2Ascii = Hex2Ascii & Chr$(Val("&H" & Mid(Hcs, a, 2)))
    Next
End Function
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…