[Lazarus] TFileStream

Dave Coventry dgcoventry at gmail.com
Mon Jan 26 14:49:24 CET 2009


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,' ');
  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?



More information about the Lazarus mailing list