Oppure

Loading
Questo topic e' stato chiuso dal moderatore.
29/07/07 12:57
antoniol
Vorrei sapere come si fa a convertire un testo da ascii a binario e viceversa. Come si fa? ;);););):love::love::love::love:

Buona estate
Ultima modifica effettuata da antoniol 29/07/07 12:58
aaa
29/07/07 14:01
Dax89
Ciao!!:D
Nel namespace System.Text, c'è la classe ASCIIEncoding e una proprietà ASCII.
La proprietà ASCII contiene il metodo GetBytes(), che, prende una stringa come parametro e restituisce i rispettivi bytes.
Poi c'è il metodo che GetString(), che fa il contrario prende come parametro un array di bytes e l'equivalente ASCII sotto forma di string.:k:
aaa
29/07/07 16:18
Il Totem
Ha scritto binario. Forse intende in notazione binaria. Potresti quindi usare questa funzione che converte un numero byte in binario:
Function ToBin(B As Byte) As String
Dim S As String
For I As Int16 = 7 To 0 Step -1
  If B >= (2 ^ I) Then
    B -= 2 ^ I
    S += "1"
  Else
    S += "0"
  End If
Next
End Function

Function ToByte(Bin As String) As Byte
  Dim B As Byte
  For I As Byte = 0 To 7
    B += Val(Bin.Chars(I)) * 2 ^ (7 - I)
  Next
End Function
aaa