I
I.Charitopoulos
The reason I want to do so, is that I am sending to DOS and I am pretty
certain that it will not work.
Everything I've tried so far hasnt.
In my test environment (Windows to Windows) this works perfectly, but not
when sending to DOS:
Private Function bytearray2string(ByVal input As Byte()) As String
Dim output As String
output = System.Text.Encoding.Default.GetString(input)
Return output
End Function
Private Function string2bytearray(ByVal input As String) As Byte()
Dim output() As Byte
output = System.Text.Encoding.Default.GetBytes(input)
Return output
End Function
I have also tried this, to no avail in Windows:
Private Function bytearray2string2(ByVal input As Byte()) As String
Dim output As String = ""
Dim i As Integer = 0
'Dim vchar As Char
While i < input.Length
output = output & CChar(Chr(input.GetValue(i)))
i = i + 1
End While
Return (output)
End Function
Private Function string2bytearray2(ByVal input As String) As Byte()
Dim output(input.Length - 1) As Byte
Dim i As Integer = 0
For i = 0 To UBound(output)
output(i) = CByte(Asc(input.Chars(i)))
Next
Return (output)
End Function
The desired functions need to use no encoding and be able to work with
simple bytes. The values I'll be receiving wont be higher anyway.
I'd appreciate any feedback whatsoever.
regards,
J
certain that it will not work.
Everything I've tried so far hasnt.
In my test environment (Windows to Windows) this works perfectly, but not
when sending to DOS:
Private Function bytearray2string(ByVal input As Byte()) As String
Dim output As String
output = System.Text.Encoding.Default.GetString(input)
Return output
End Function
Private Function string2bytearray(ByVal input As String) As Byte()
Dim output() As Byte
output = System.Text.Encoding.Default.GetBytes(input)
Return output
End Function
I have also tried this, to no avail in Windows:
Private Function bytearray2string2(ByVal input As Byte()) As String
Dim output As String = ""
Dim i As Integer = 0
'Dim vchar As Char
While i < input.Length
output = output & CChar(Chr(input.GetValue(i)))
i = i + 1
End While
Return (output)
End Function
Private Function string2bytearray2(ByVal input As String) As Byte()
Dim output(input.Length - 1) As Byte
Dim i As Integer = 0
For i = 0 To UBound(output)
output(i) = CByte(Asc(input.Chars(i)))
Next
Return (output)
End Function
The desired functions need to use no encoding and be able to work with
simple bytes. The values I'll be receiving wont be higher anyway.
I'd appreciate any feedback whatsoever.
regards,
J