You can use the TFileStream.CopyFrom method to copy to an unwanted line, go past it, and then copy the rest of the file again. TFileStreams is pretty fast.
Something like this (untested)
aInFile := TFileStream.Create(sInput, fmOpenRead);
try
aOutFile := TFileStream.Create(sOutput, fmCreate);
try
aOutFile.CopyFrom(aInFile, Pos);
aInFile.Seek(Skip);
aOutFile.CopyFrom(aInFile, aInfile.Size - Pos - Skip);
finally
aOutFile.Free;
end;
finally
aInFile.Free;
end;
source
share