Foxtable(狐表)用户栏目专家坐堂 → 读取超过100M的文本文件


  共有4332人关注过本帖树形打印复制链接

主题:读取超过100M的文本文件

帅哥哟,离线,有人找我吗?
Bin
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:35433 积分:178524 威望:0 精华:3 注册:2013/3/30 16:36:00
  发帖心情 Post By:2015/5/4 9:05:00 [显示全部帖子]

Dim path As String = "c:\MyTest.txt"

        Try
            If FileSYS.FileExists(path) Then
                FileSYS.DeleteFile(path)
            End If

            Dim sw As IO.StreamWriter = New IO.StreamWriter(path)
            sw.WriteLine("This")
            sw.WriteLine("is some text")
            sw.WriteLine("to test")
            sw.WriteLine("Reading")
            sw.Close()

            Dim sr As IO.StreamReader = New IO.StreamReader(path)
            Dim newValue As String
            Dim oldValue As String
            Do While sr.Peek() > 0
                 newValue = sr.ReadLine()
                 oldValue = IIF(newValue <> "" , newValue , oldValue)
            Loop
            sr.Close()
            output.show(oldValue)
        Catch e As Exception
            output.show("The process failed:" & e.ToString())
        End Try

 回到顶部