Forum: Object-Pascal / Delphi-Language
Delphi
by marabu,
9. Apr 2006
Hier noch eine vierte Möglichkeit - solange TextFile noch unterstützt wird - allerdings nur getippt und nicht getestet:
procedure GetLines(fn: TFileName; s: TStrings; iStart, iCount: Cardinal);
const
BUF_SIZE = 16 shl 10;
var
tf: TextFile;
buf: array of Char;
iLine: Cardinal;
Forum: Object-Pascal / Delphi-Language
Delphi
by marabu,
9. Apr 2006
Für Fall 1 ist die Lösung recht einfach:
function LoadStringFromFile(fn: TFileName; iOffset, iSize: Cardinal): String;
begin
with TFileStream.Create(fn, fmOpenRead) do
try
Position := iOffset;
SetLength(Result, iSize);
Read(Result, iSize);