[EMAIL PROTECTED] wrote:

Ok, guys. it's only been like 15 years since I have written any pascal code. Can someone please help me with syntax for opening a file so that I can read variable length lines of text from it, then output to another file. Running in DOS on an x86 machine. Thank you.

Hi Jason,


procedure ReadFile(const FileName: string);
var
f: TextFile;
st: string;
begin
assignfile(f,FileName);
reset(f);
while not eof(f) do
begin
readln(f, st); // here you are reading one line from the file at every loop
// do what you want with st
writeln(st); // for example
end;
closefile(f);
end;


// main
begin
 ReadFile('c:\autoexec.bat');
end.

--
Jilani



_______________________________________________
fpc-pascal maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to