out of memory during a loop of txt file
I use this routine to read txt file line by line...
i loop approx 123 files each file are of 45/80 MB. (approx 358.000 line per file)
i use (pseudo code):
...
for each file in my dir
TEST1(name_file )
next
...
Sub TEST1(name_file )
Dim temp As String
Dim MyArray() As String
Dim FileID As Integer
FileID = FreeFile
Open "C:\TEST\" & name_file For Binary Access Read As #FileID
temp = Space(LOF(FileID))
Get #FileID, , temp
Close #FileID
Erase MyArray()
MyArray() = Split(temp, vbNewLine)
temp = ""
Dim X As Long
For X = LBound(MyArray()) To UBound(MyArray())
temp = MyArray(X) 'Is the; current; Line
Next
End Sub
but after the 3thfile processed have Out of Memory!!!!
Re: out of memory during a loop of txt file
Re: out of memory during a loop of txt file
Quote:
Originally Posted by
Bonnie West
ok tks!!!!
but in wich part of code i can loop "line by line" the array.... similar:
Dim X As Long
For X = LBound(MyArray()) To UBound(MyArray())
temp = MyArray(X) 'Is the; current; Line
Next
Re: out of memory during a loop of txt file
Can you post the relevant parts of your code? Your current For loop will have to be modified to properly work with that technique.
Re: out of memory during a loop of txt file
Quote:
Originally Posted by
luca90
I use this routine to read txt file line by line...
i loop approx 123 files each file are of 45/80 MB. (approx 358.000 line per file)
...
but after the 3thfile processed have Out of Memory!!!!
You could look into changing some string to currency ?
clear some variables = null
look into converting dos/linux crlf/lf formatting required with some files.