Writes a section of a character array
Imports System
Imports System.IO
Public Class BinaryRW
Shared Sub Main()
Dim invalidPathChars() As Char = Path.InvalidPathChars
Dim memStream As new MemoryStream()
Dim binWriter As New BinaryWriter(memStream)
binWriter.Write("test: ")
binWriter.Write(Path.InvalidPathChars, 0,Path.InvalidPathChars.Length)
Dim binReader As New BinaryReader(memStream)
memStream.Position = 0
Console.Write(binReader.ReadString())
Dim upperBound As Integer = CInt(memStream.Length - memStream.Position) - 1
Dim memoryData(upperBound) As Char
binReader.Read(memoryData, 0, upperBound)
Console.WriteLine(memoryData)
End Sub
End Class
Related examples in the same category