[Lazarus] FW: Re: more file operation problems
Chris Kelling
kellingc at cox.net
Mon Dec 12 21:05:30 CET 2011
-------- Begin forwarded message --------
Subject: Re: [Lazarus] more file operation problems
Date: 12/12/11 2:35:32 PM
From: "Chris Kelling" <kellingc at cox.net>
To: henry.vermaak at gmail.com
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
More information about the Lazarus
mailing list