[Lazarus] read text file in lazarus

Graeme Geldenhuys graemeg.lists at gmail.com
Fri Apr 3 15:58:33 CEST 2009


  2009/4/3 Dians <diansopandi95 at gmail.com>:
> interesting but i'm still newbie.. how do i read text file in lazarus ,  i
> have been looking for documentation but i have not still get it yet, i have

You could also use the RTL as follows:

var
  sl: TStringList;
begin
  sl := TStringList.Create;
  sl.LoadFromFile('/tmp/readme.txt');

  // now you can access each line of the text file via
  //   sl.Strings[i]
  // see help on TStringList and TStrings for more info

  sl.Free;
end;


Regards,
  - Graeme -


_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/




More information about the Lazarus mailing list