Leaders quwiltw Posted February 3, 2003 Leaders Posted February 3, 2003 anyone have a code snippet using the filestream class? the documentation says "In the following example,..." and there is no example following. Quote --tim
Moderators Robby Posted February 3, 2003 Moderators Posted February 3, 2003 Public Function SaveToFile(ByVal saveThis As String) As Boolean Try Dim sb As New FileStream(Application.StartupPath & "\test.txt", FileMode.OpenOrCreate) Dim sw As New StreamWriter(sb) sw.Write(saveThis) sw.Close() Return True Catch Return False End Try End Function Private Function OpenFile() As Boolean Dim sr As StreamReader sr = File.OpenText(Application.StartupPath & "\test.txt") Dim strItems As String 'loop through the text file While sr.Peek <> -1 strItems = sr.ReadLine() 'using [b]strItems[/b] add eachline to something here End While sr.Close() Return True 'file was there...with no errors End Function Quote Visit...Bassic Software
Leaders quwiltw Posted February 3, 2003 Author Leaders Posted February 3, 2003 Thanks Robby, I was hoping to see an example that used BeginRead/Write and EndRead/Write to reduce the need to load the entire file into memory in order to read it. For example, if you had a B+Tree and knew the size of every node and want to only load one specific subtree into memory and not the entire file. Quote --tim
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.