FileMode.OpenOrCreate : FileMode « Stream File « VB.Net Tutorial






Imports System.IO


Public Class Tester
    Public Shared Sub Main
        Dim fs As System.IO.FileStream
        Dim w As System.IO.BinaryWriter
        Dim buffer As String
        Dim c As Char
        c = Chr(9)

        fs = New System.IO.FileStream("test.txt", IO.FileMode.OpenOrCreate)
        w = New System.IO.BinaryWriter(fs)

        w.Seek(0, System.IO.SeekOrigin.Begin)

        w.Write("writing data via BinaryWriter")
        w.Close()
        fs.Close()
    End Sub

End Class








13.5.FileMode
13.5.1.FileMode.OpenOrCreate
13.5.2.FileMode.Open with FileAccess.Read
13.5.3.Create File with FileMode.CreateNew