by Timothy Pew (3 Submissions)
Category: Files/File Controls/Input/Output
Compatability: Visual Basic 3.0
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating:
(3 Votes)
Opens a text file much fast than a "Do While Not EOF(filenumber)" loop. Makes
file load times almost non-existant.
Inputs
The filename of the file to open.
Assumes
The filename that you pass to the function must exist, otherwise an error will occur.
Code Returns
The text contained in the file.
Side Effects
I have yet to run into any. If you do happen to find one leave a comment and
I will fix it.
Public Function OpenFile(ByVal file As String) As String
Dim i As Integer
i = FreeFile
Open file For Input As #i
OpenFile = Input(LOF(i), i)
Close #i
End Function