[Lazarus] FW: Re: more file operation problems

Chris Kelling kellingc at cox.net
Mon Dec 12 21:42:53 CET 2011



On Mon, DEC 12, 2011 at 3:22 PM, Sven Bart wrote:


Am 12.12.2011 21:20 Schreiber "Sven Bart" < pascaldragon at googlemail.com 
<javascript:parent.wgMail.openComposeWindow('pascaldragon at googlemail.com')> 
>:
>
> Am 12.12.2011 21:05 Schreiber "Chris Feeling" < kellingc at cox.net 
> <javascript:parent.wgMail.openComposeWindow('kellingc at cox.net')> >:
>> That worked, but now, later in the code:
>>  Rowan := 1;  while Rowan <= stgInvOps.Row Count do        begin     
>>      read(inventory,stock);          stgInvOps.Cels[0,Rowan] := 
>> into(stockcars);          inc(Rowan);        end;   close 
>> file(inventory);
>
> Replace the "<=" condition by "<". The row indices go from 0 to Row 
> Count-1. And replace the "Rowan := 1" by "Rowan := 0" of course.

Row[0] is my header row and has fixed cells.

I do have more than one column, but I figured get one column working and 
adding the others will be the same.  I do see a math error, though - I 
set the number of row to the number of records in the file, but I forgot 
to add in the header row, stgInvOps.RowCount needs to be one greater 
than the number of records.

That aside, I'm still having trouble getting the system to read from the 
file, and with the math error should get an out of range error not 
access denied or SIGSEGV.   In fact, I replaced 'rowNum <= 
stgInvOps.count' with 'not eof(inventory)', and got the same error.

Thank you for your help thus far.
-Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20111212/f11f8cfe/attachment-0003.html>


More information about the Lazarus mailing list