Re: Problem with large .txt file [message #55131 is a reply to message #55044] |
Tue, 31 July 2007 12:37   |
Haje Korth
Messages: 651 Registered: May 1997
|
Senior Member |
|
|
True, the variable is not the problem. It will give a wrong line count but
this is not cause for memeory error. Now I am puzzled. I am reading text
files up to 100MB without problems. I am sure bigger ones work too. I
fold... H.
"Jeff N." <jnettle1@utk.edu> wrote in message
news:1185908328.461871.25230@m37g2000prh.googlegroups.com...
> On Jul 31, 12:03 pm, "aleks.fra...@gmail.com" <aleks.fra...@gmail.com>
> wrote:
>> Hy there!
>> I have a large txt file (6.384KB) with 65000 lines. It's very large.
>> I need to open it, read every line, replace the spaces for commas, and
>> write the result in an output.txt
>>
>> The code is ok. The problem is that idl crashes on line 7208. There's
>> a memory problem there.
>>
>> Is there any way to do for all the lines of the txt file?? I don't
>> know how to deal with memory problems. Sorry!
>>
>> I'm doing like this
>>
>> :-----------------CUT HERE--------------------
>> i=0
>> line=''
>> ; Open the text file:
>> OPENR, inunit, '60mil_equal.txt', /GET_LUN
>> ; Open the terminal as a file:
>> OPENW, outunit, 'output.txt', /GET_LUN
>> ;================================
>> WHILE ~EOF(inunit) DO BEGIN
>> READF, inunit, line
>> line = STRJOIN(STRSPLIT(line, /EXTRACT), ', ')
>> PRINTF, outunit, line
>> i =i+1
>> ENDWHILE
>>
>> FREE_LUN, inunit
>> FREE_LUN, outunit
>>
>> END
>> :-----------------CUT HERE--------------------
>>
>> Thank you very much
>
> I must be missing something, but I don't see you actually using the
> variable i for anything. All you do is increment it each time around
> the loop. Unless this isn't the final version of your code and you're
> going to add functionality that uses that variable, you could take it
> out.
>
> Jeff
>
|
|
|