Author Topic: Go back to readln the first line again  (Read 3733 times)

asdf

  • Sr. Member
  • ****
  • Posts: 310
Go back to readln the first line again
« on: November 12, 2010, 05:00:22 am »
assignfile(dottxt,eFileNameEdit.Text);
try
reset(dottxt);
readln(dottxt,ln);  // 1.
if leftstr(ln,5) <> '<Doc>' then
readln(dottxt,ln);  // 2.
if leftstr(ln,9) = '<esearch>' then   

I have readln'ed 2 times(lines) just to verify the text file.
How I can go back to the first line of textfile to loop?
Lazarus 1.2.4 / Win 32 / THAILAND

Yogi

  • New Member
  • *
  • Posts: 42
Re: Go back to readln the first line again
« Reply #1 on: November 12, 2010, 07:35:22 am »
Why not using a TStringList?

l:=tstringlist.create;
l.loadfromfile(efilenameedit.text);

Now You can access each line via l.strings[index] seperatly
Lazarus 1.3 SVN 44197 * FPC 2.7.1 SVN 26822
Linux: 3.2.0-4-686-pae * Debian wheezy
Windows: W98

 

TinyPortal © 2005-2018