[fpc-pascal] TFileStream.SetSize sometimes fails

Martin lazarus at mfriebe.de
Thu Aug 13 22:33:02 CEST 2009

Mattias Gaertner wrote:
> On Thu, 13 Aug 2009 21:46:23 +0200 (CEST)
> Michael Van Canneyt <michael at freepascal.org> wrote:
>> On Thu, 13 Aug 2009, Mattias Gaertner wrote:
>>> I want to replace the content of an existing file (keeping the type
>>> and rights). I used:
>>> fs := TFileStream.Create(Filename, fmOpenWrite or fmShareDenyNone);
>>> fs.Size := 0;
>>> fs.Write(.....);
>>> fs.Free;
>>> But it does not always work. The line fs.Size does not clear the
>>> file on every file system. So the fs.Write only replaces the first
>>> part of the file.
>> If it depends on the filesystem, then you should complain with the
>> linux kernel people ?
> I'm not sure if it is a kernel thing. I don't have a vbox to test.
> That's why I ask. Maybe someone knows more.
Have a look here:

It never was fixed, just no-one was able to reproduce for some time. 
However it was with an xp guest on an ubunto host => we have it the 
other way round

More information about the fpc-pascal mailing list