-------- Begin forwarded message --------
Subject: Re: [Lazarus] more file operation problems
Date: 12/12/11 2:35:32 PM
From: "Chris Kelling" <[email protected]>
To: [email protected]


On Mon, Dec 12, 2011 at 12:17 PM, Henry Vermaak wrote:

On 12/12/11 17:09, Chris Kelling wrote:
I'm trying to assign the number of records to the rowCount of a
stringgrid control. See the following code fragment:

var
stock : stockitem;
rowNum : integer;
{inventory is defined as a file of stockitem in another unit}

begin
assignfile(inventory,'Ops');
reset(inventory);
stgInvOps.RowCount:= filesize(inventory);

It's using the wrong function, try System.FileSize?

That worked, but now, later in the code:

  rowNum := 1;
  while rowNum <= stgInvOps.RowCount do
        begin
          read(inventory,stock);
          stgInvOps.Cells[0,rowNum] := inttostr(stock.ClassNumber);
          inc(rowNum);
        end;
   closefile(inventory);

when I try to read from the file, in the IDE I get an exception:

Project Spares raised an exception class: 'External: SIGSEGV'

Running the exe outside the IDE, I get:
Access Violation

Press OK to ignore and risk data corruption.
Press Cancel to kill the program.

This is really getting frustrating.

-Chris

--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to