Hello, I'm using the VB6 binary-to-text function below to encode 100kB - 600kB byte arrays to a string on-the-fly, right before sending them to a server that only accepts text. When uploading with a fast internet connection, there's quite a bit of speed loss due to this (slow) encoding with VB6. The function written in C++ would make it a bit faster and perhaps use less CPU as well.

I would kindly like to ask if somebody here, who knows both VB6 and C++, is willing to spend a moment of their time to convert this function to C++ and create a Win32 DLL for me (or just the code, then I'll search for a compiler myself).

Thank you.

Code:
Public Function EncodeArray(bIn() As Byte) As String

    Dim bOut() As Byte, lChar As Long, lPos As Long, bTest As Byte, lLine As Long
    Dim lMax As Long
    
    ReDim bOut(UBound(bIn) * 2)             'Make the output buffer.  Double size will almost always be enough.  2 extra
                                            'chars per 72 and worst case would be all characters escaped.  If so, use Base64.
    lMax = UBound(bIn)
    For lChar = 0 To lMax
        bTest = (bIn(lChar) + 42) Mod 256   'Try the prefered transform.
        Select Case bTest
            Case 1 To 8, 11 To 12, 14 To 45, 47 To 60, 62 To 255    'Normal processing
                bOut(lPos) = bTest
                lPos = lPos + 1
                lLine = lLine + 1
            Case 46                         'Test for column one, escape if in that col.
                If lLine <> 0 Then
                    bOut(lPos) = bTest
                    lPos = lPos + 1
                    lLine = lLine + 1
                Else
                    bOut(lPos) = 61
                    bOut(lPos + 1) = (bTest + 64) Mod 256
                    lPos = lPos + 2
                    lLine = lLine + 2
                End If
            Case Else                       'Critical char, needs to be escaped.
                bOut(lPos) = 61
                bOut(lPos + 1) = (bTest + 64) Mod 256
                lPos = lPos + 2
                lLine = lLine + 2
        End Select
        If lLine >= 128 Then           'Add a vbCrLf
            bOut(lPos) = 13
            bOut(lPos + 1) = 10
            lPos = lPos + 2
            lLine = 0
        End If
    Next lChar
    
    ReDim Preserve bOut(lPos - 1)           'Truncate the unused portion of the buffer.
    EncodeArray = StrConv(bOut, vbUnicode)      'Convert to a string and return it.
    
End Function