Reading Text File

  • Thread starter Thread starter Roy Goldhammer
  • Start date Start date
R

Roy Goldhammer

Hello there

I've build program that Read Text file and store it on Access table
according to Structure

i read the data using Line Input command

Is there a way to know what is the actual Location on the file i'm right
now?

And is there a way to know what is the size of the file?

so i can show to the user in percent the process of reading text file?

--
øåòé âåìãäîø
ù.î. òúéã äðãñú úåëðä
(e-mail address removed)
èì: 03-5611606
ôìà' 050-7709399
 
You can determine the total size of the file using the FileLen function.

Assuming you're using Line Input to read each line into a variable, you can
use the Len function on that variable after each read to determine where you
are in the file.

Something like the following untested air-code:

Dim intFile As Integer
Dim lngCurr As Long
Dim lngTotal As Long
Dim strBuffer As String
Dim strFile As String

strFile = "<full path to file>"
lngTotal = FileLen(strFile)
intFile = FreeFile
Open strFile For Input As #intFile
Do While Not EOF(intFile)
Line Input #intFile, strBuffer
lngCurr = lngCurr + Len(strBuffer)
' At this point, you've read lngCurr characters
' (out of a total lngTotal characters in the file)
Loop
Close #intFile
 

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

Similar Threads

Get Data from source safe 4
Merging two Tif files to one file 5
error 3709 3
Waiting for finish Shell Function 1
Using Class Module 5
Using MODI on access 1
Using Type in collection 1
Getting excel Sheets 1

Back
Top