Public Class fileoperation
    Public operated As System.IO.FileStream
    Sub New(ByVal filepath As String)
        operated = New System.IO.FileStream(filepath, IO.FileMode.OpenOrCreate, IO.FileAccess.ReadWrite)
    End Sub

    Function read()
        Dim o As New System.IO.StreamReader(operated)
        Dim ss = o.ReadLine
        operated.Seek(0, IO.SeekOrigin.Begin)
        Return ss
    End Function

    Sub write(ByVal s As String)
        Dim o As New System.IO.StreamWriter(operated)
        o.Write(s)
        o.Flush()
        operated.Seek(0, IO.SeekOrigin.Begin)
    End Sub

End Class


VS2005기준, 이렇게 하면 된다.

다른 방법도 아주 많겠지만, 이게 가장 좋은 구현도 아니겠지만, 아무튼 난 이렇게 했음.

by snowall 2012.07.17 17:45