Suggestions for Reading a Test File

D

Don

Any suggestions on opening and reading a (small) text file for parsing? I
have seen post on occasion for and against the FSO approach. (The code
sample I have uses a MS Common Dialog control on a form to open a file.)
Whatever method I end up with, I just need to read each line into a string.

(I just tried doing some research on msdn.microsoft.com but the site appears
to be hosed up. Maybe system maintenance or something.)

Pointers to references would be appreciated!

Thanks!

Don
 
R

rkc

Don said:
Any suggestions on opening and reading a (small) text file for parsing? I
have seen post on occasion for and against the FSO approach. (The code
sample I have uses a MS Common Dialog control on a form to open a file.)
Whatever method I end up with, I just need to read each line into a string.

This will read the whole file into a string.

Function GetFileContent(path As String) As String
Dim s As String
Dim f1 As Long

f1 = FreeFile
Open path For Binary As #f1
s = String(LOF(f1), " ")
Get #f1, , s

Close #f1
GetFileContent = s

End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top