Results 1 to 2 of 2

Thread: Read/Write Text files

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 1999
    Posts
    46

    Post

    Hello, I search for code to read and write text file. I want to open large files(100K +) and then read them and in the end write them back to files.

    Thank you very much,
    Kiron

  2. #2
    Guest

    Post

    Reading and writing to text files is easy...

    Stick this code in a module and have done with it!!

    Code:
    Option Explicit
    
    Function OpenFile(Filename As String) As String
        
    On Error Resume Next
    Open Filename For Input As #1
    OpenFile = Input(LOF(1), 1)
    Close #1
        
    End Function
    
    Sub SaveFile(Filename As String, Text As String)
        
    On Error Resume Next
    Open Filename For Output As #1
    Print #1, Text
    Close #1
    
    End Sub
    As for using text files bigger than 100K, you'll have to use a more chunky text box than the one that comes with VB, as that only handles strings upto 64K (I think).

    ------------------
    Matthew Ralston
    E-Mail: m.ralston@mediavault.co.uk
    ICQ:31422892
    Web Sites:The Blue Link My Home Page


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width