JM> How do you read a text file in Delphi 3? That is, what is
JM> the equivalent of
JM> var f : text;
JM> line : string;
JM> ...
JM> assign( f, 'text.dat');
JM> reset( f);
JM> readln( f, line);
JM> close( f);
Hi, Jud...
you can do it of two ways:
1) var
f:textfile:
line:string;
[...]
assignfile(f,'text.dat');
reset(f));
while not(eof(f)) do { while not end of file do}
begin
readln(f,line); {read a line}
memo1.lines.add(line); {add the line to the Memo component}
end;
closefile(f);
2) The way easiest is:
-> memo1.lines.loadfromfile('text.dat');
Only one line and you have the same file in a Memo component.
Remember that if you want to clear the component use:
-> memo1.clear;
That`s all folks !!!
Esta es la va del futuro Ŀ Miguel Sigenza
para el virus Windows 95 9 E-Mail: m-siguenza@bdd.unizar.es
ѳ5
ϳWindows ܳ
... Mensaje con sonido, configurado actualmente para: No Sound.
---
---------------
* Origin: Lawrence de Arabia: Esta' todo aqui' (2:342/13)
|