VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



ReadFile

by James Vincent Carnicelli (21 Submissions)
Category: String Manipulation
Compatability: Visual Basic 3.0
Difficulty: Unknown Difficulty
Date Added: Wed 3rd February 2021
Rating: (4 Votes)

Read an entire text file into a string in one call.

Inputs
sFileName As String
Code Returns
String containing file contents.

Rate ReadFile

Public Function ReadFile(ByVal sFileName As String) As String
  Dim fhFile As Integer
  fhFile = FreeFile
  Open sFileName For Binary As #fhFile
  ReadFile = Input$(LOF(fhFile), fhFile)
  Close #fhFile
End Function

Download this snippet    Add to My Saved Code

ReadFile Comments

No comments have been posted about ReadFile. Why not be the first to post a comment about ReadFile.

Post your comment

Subject:
Message:
0/1000 characters