Kiron
Nov 28th, 1999, 07:49 PM
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
Reading and writing to text files is easy...
Stick this code in a module and have done with it!!
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 (http://195.89.158.103/icq.html)
Web Sites:The Blue Link (http://195.89.158.103) My Home Page (http://mralston.cjb.net)