[Lazarus] TFileStream
Michael Van Canneyt
michael at freepascal.org
Thu Jan 29 10:00:55 CET 2009
On Thu, 29 Jan 2009, Dave Coventry wrote:
> ============= snip ===================
> case ftype of
> 43://'+'
> begin
> FS:=TFileStream.Create(fname, fmshareDenyWrite);
> Try
> FS.Seek(pos,soFromBeginning);
> FS.ReadBuffer(fldheader[0],4);
> increm:=LEtoN(PLongInt(fldheader)^)+1;
> for m:=0 to 3 do
> begin
> fldheader[m]:=increm and 255;
> increm:=increm shr 8;
> end;
> FS.Seek(pos,soFromBeginning);
> FS.WriteBuffer(fldheader[0],4); <----- Fails here
> Finally
> FreeAndNil(FS);
> end;
> end;
> end;
> ============= snip ===================
>
> Continuing on the same block:
>
> I am trying to read a block of 4 bytes, increment it by one and write
> it back again.
>
> However, if fails on the write.
Probably because you failed to specify fmOpenReadWrite.
fmshareDenyWrite does not automatically mean write access.
Michael.
> _______________________________________________
> Lazarus mailing list
> Lazarus at lazarus.freepascal.org
> http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
>
More information about the Lazarus
mailing list