Convert.ToBase64String converts 8-bit unsigned integers to string encoded with base-64 digits.
Class Sample
Public Shared Sub Main()
Dim inFile As System.IO.FileStream
Dim binaryData() As Byte
inFile = New System.IO.FileStream("c:\\a.txt", System.IO.FileMode.Open, System.IO.FileAccess.Read)
ReDim binaryData(inFile.Length)
Dim bytesRead As Long = inFile.Read(binaryData, 0, inFile.Length)
inFile.Close()
Dim base64String As String
base64String = System.Convert.ToBase64String(binaryData, 0, binaryData.Length)
Dim outFile As System.IO.StreamWriter
outFile = New System.IO.StreamWriter("c:\\b.txt", False, System.Text.Encoding.ASCII)
outFile.Write(base64String)
outFile.Close()
End Sub
End Class
Related examples in the same category