Posts: 1,769
Threads: 410
Joined: Feb 2003
i have a file that is really large and i need to clip off the first three or four lines but it's so large that I keep getting "Insufficient system resources exist to complete the requested service." I tried looking into the File variable but can't find a way to clip the lines out.
is there a way to do this?
thanks.
Posts: 12,135
Threads: 142
Joined: Dec 2002
I never tried to do something similar, but would try to: Open the file with File f.Open("file" "r"), read the first several lines, then sequentially read to eg 64 KB buffers and write to another file opened eg with File f2.Open("file2" "w"). When done, delete file1 and rename file2.
Posts: 1,769
Threads: 410
Joined: Feb 2003
ReadLine seems to only pull 301 characters.
is there a reason that it isn't pulling the whole line?
it looks like the function is set to only pull so many characters (256) can that be changed without making it all unstable?
Posts: 12,135
Threads: 142
Joined: Dec 2002
It is a bug. Replace File.ReadLine code to
function# str&line ;;Returns 1 on success, 0 on EOF.
if(!m_file) end ES_INIT
int n1 n2
if(line.nc<250) line.all(250); else line.len=0
rep
,n1=line.nc-line.len
,if(fgets(line+line.len n1 m_file))
,,n2=len(line+line.len)
,,line.fix(line.len+n2)
,,if(n2<n1-1 or line[line.len-1]=10) line.rtrim("[]"); ret 1
,,line.all(line.len+250 1)
,else if(line.len) ret 1
,else ret
Posts: 1,769
Threads: 410
Joined: Feb 2003
Posts: 1,769
Threads: 410
Joined: Feb 2003
should this new code have made it into the new 2.2 version?
Posts: 12,135
Threads: 142
Joined: Dec 2002
Posts: 1,769
Threads: 410
Joined: Feb 2003
mine shows this
line.all(line.len+1000 1)
Posts: 12,135
Threads: 142
Joined: Dec 2002
Just changed 250 to 1000 to allocate more.