Re: Files.Posted by Jean Claude Servaye on May 03, 2001 at 01:56:02: In Reply to: Files. posted by GuptiRanj. on May 03, 2001 at 01:24:03: exemple:
Var F : TextFile; A : String; Begin AssignFile(F,'test.txt'); RewriteFile(F); // create the file, if the file already exist it is emptied Writeln(F,'first line in the file'); // write im the file Writeln(F,'second line'); .... CloseFile(F); // close de file end; to read the file:
Begin AssignFile(F,'test.txt'); Reset(F); // Open an existing file While not eof(F) do begin Readln(F,A); // read a line in the file .... // do something with A end; CloseFile(F); // close de file End;
|
|