[Lazarus] several weird behaviors with Lazarus

ik idokan at gmail.com
Mon Jan 26 20:05:51 CET 2009


On Mon, 26 Jan 2009 15:49:24 +0200
Dave Coventry <dgcoventry at gmail.com> wrote:

> I'm having some difficulty over this:
> 
> ============= snip ===================
>   FS:=TFileStream.Create(fname, fmshareDenyWrite);
>   Try
>     FS.ReadBuffer(hdbuffer[0],32);
>   Finally
>     FreeAndNil(FS);
>   end;
>   RecSize:=LEtoN(PSmallInt(@hdbuffer[10])^);
>   SetLength(recbuffer,RecSize);
>   FillChar(recbuffer,RecSize,' ');

Maybe you mean
FillChar(recbuffer^,RecSize,' ');
?

>   pos:=68;
>   bufferpos:=1;
>   setLength(fldheader,48);
>   for i:=0 to gFields.Count-1 do
>   begin
>     ftype:=getFieldType(PChar(gFields.GetItem(i)));
>     case ftype of
>       43://'+'
>       begin
>         FS:=TFileStream.Create(fname, fmshareDenyWrite);<----- Fails
> here Try
>           FS.Seek(pos,soFromBeginning);
>           FS.ReadBuffer(fldheader[0],4);
>         Finally
>           FreeAndNil(FS);
>         end;
>       end;
> ============= snip ===================
> 
> Project raised exception class 'External: SIGSEgV'
> 
> Followed by:
> 
> Project raised exception class 'RunError (216)'
> 'Access Violation'
> 
> What am I doing wrong?


Mattias



More information about the Lazarus mailing list