waipahu
asked on
Reading text file backwards
Is there to read a text file backwards?
I know u can read it foward sequentially....
Read or Realn
but how do u read it backwards....
also, anybody have any clue on getting the novell user login
id..i posted this on another question...did the
WNETGETUser but it is unstable..sometimes it works
and other times it doesnt...
thanks a lot!
I know u can read it foward sequentially....
Read or Realn
but how do u read it backwards....
also, anybody have any clue on getting the novell user login
id..i posted this on another question...did the
WNETGETUser but it is unstable..sometimes it works
and other times it doesnt...
thanks a lot!
ASKER
Thanks Wilson...
Your solution will work with a lot of situations...however, i dont think
it will work when i have a gigantic text file..
i wanted to read a page at a time....
i guess i'm more concerned about trying to keep track of where the pointer
is pointing to....i am trying to write a program to read a report that was
generated on a UNIX machine..each page on the report has a form feed chr(12) or #12
i want to read a page at a time until i hit the form feed character...
when the user pressed page down i want to read the next page starting from
the form feed character until the next form feed character - 1 line. if the user
pressed page up then i want to read the previous page...possible reading backwards
or repositioning the pointer and read from that point on.
make any sense?
Thanks again!!!!!
p.s. some reports may be over a thousand pages in size....thats why i cant
read it all one time.....
Your solution will work with a lot of situations...however, i dont think
it will work when i have a gigantic text file..
i wanted to read a page at a time....
i guess i'm more concerned about trying to keep track of where the pointer
is pointing to....i am trying to write a program to read a report that was
generated on a UNIX machine..each page on the report has a form feed chr(12) or #12
i want to read a page at a time until i hit the form feed character...
when the user pressed page down i want to read the next page starting from
the form feed character until the next form feed character - 1 line. if the user
pressed page up then i want to read the previous page...possible reading backwards
or repositioning the pointer and read from that point on.
make any sense?
Thanks again!!!!!
p.s. some reports may be over a thousand pages in size....thats why i cant
read it all one time.....
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I forgot something.. make sure that the constant MAXLINELENGTH is appropriate..
and yes.. you can use this in a unix environment .. and if you want to read a page at a time, exchange the #10 with a #12 - that's all!
Peter (ptiemann2)
and yes.. you can use this in a unix environment .. and if you want to read a page at a time, exchange the #10 with a #12 - that's all!
Peter (ptiemann2)
var
TheFile : TStringList;
i : integer;
begin
TheFile := TStringList.Create;
TheFile.LoadFromFile('File
for I := TheFile.lines.count - 1 downto 0 do
begin
//Do stuff with TheFile.lines[i]...
end;
TheFile.Free;
end;
Cheers,
Raymond.