Writes a character array : Binary File Write « File Directory « VB.Net

Home
VB.Net
1.2D
2.Application
3.Class
4.Data Structure
5.Data Types
6.Database ADO.net
7.Date Time
8.Development
9.Event
10.File Directory
11.Generics
12.GUI
13.Internationalization I18N
14.Language Basics
15.LINQ
16.Network Remote
17.Reflection
18.Security
19.Thread
20.Windows Presentation Foundation
21.Windows System
22.XML
23.XML LINQ
VB.Net Tutorial
VB.Net by API
VB.Net » File Directory » Binary File WriteScreenshots 
Writes 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)

        Dim binReader As New BinaryReader(memStream)

        memStream.Position = 0

        Console.Write(binReader.ReadString())
        Console.WriteLine(binReader.ReadChars(CInt(memStream.Length - memStream.Position)))

  End Sub
End Class

   
  
Related examples in the same category
1.Creating a random file
2.Use BinaryWriter to store information into a binary file
3.Save Structure to a Binary File
4.Gets the underlying stream of the BinaryWriter.
5.BinaryWriter.Seek Method Sets the position within the current stream.
6.BinaryWriter.Write Method Writes an unsigned byte to the current stream and advances the stream position by one byte.
7.BinaryWriter.Write(Byte[]) Writes a byte array to the underlying stream.
8.Writes a region of a byte array to the current stream.
9.Writes a Unicode character
10.Writes a section of a character array
11.Writes a length-prefixed string
w__w_w.__j_a___v_a___2s.__c_o_m_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.