tom99
2010-05-22 18:33:20
Read and store each line of a file to a variable from a .txt file how can this be done?
i need it for a database utility.
i need it for a database utility.
2010-05-22 18:33:20
2010-05-22 18:53:38
program New;
const
FilePath = 'C:\test.txt';
var
FileNum, i, h : integer;
s : string;
Arr : TStringArray;
begin
if not FileExists(FilePath) then
begin
Writeln('File does not exist.');
TerminateScript;
end;
FileNum := OpenFile(Filepath, False);
ReadFileString(FileNum, s, FileSize(FileNum));
CloseFile(FileNum);
Arr := Explode(#13#10, s);
h := high(Arr);
for i := 0 to h do
Writeln(Format('Line %d: %s', [i + 1, Arr[i]]));
end.
2010-05-22 20:26:19
2010-05-22 20:48:24
2010-05-22 20:54:54
2010-05-22 20:59:41
2010-05-22 21:03:14
2010-05-22 21:05:48