The class TMixedFStream will open a named file and provide methods to read from or write to it. The class supports mixed mode files (binary and readable parts mixed). The following list provides the most important properties and methods of the TMixedFStream class:
The following short program shows how to read a text file line by line. The read lines are displayed in the console window:
program ReadTextFile;
var
i : integer;
FName : string;
fs : TMixedFStream;
astr : string;
begin
FName := SelectFile (GetDLabDir(ddWork), '*.txt', 'Select a file');
if FName <> '' then
begin
fs := TMixedFStream.Create (FName, fmOpenRead);
while not fs.Eos do
begin
astr := fs.ReadLn(0);
couts (astr);
end;
fs.Free;
end;
end.