[fpc-pascal]Bug with a record type?

Johan Blok johanbloK at ix.nl
Tue Feb 20 18:46:33 CET 2001


> type
>   DataRecord   = packed record
>                    Data    : string;
>                    Display : boolean;
>                    Actual  : longint;
>                  end;
> 
> var
>   CurrentLine : longint;
>   TotalLines : longint;
>   DataFromFile : array [1..MAX_LINES] of ^DataRecord;
> 
> for CurrentLine := 1 to TotalLines do
>   if DataFromFile [CurrentLine].Display then
>   begin
>     {$I-}
>       writeln (PrinterPort,DataFromFile [CurrentLine].Data);
>     {$I+}
>     if ioresult <> 0 then Error (201,FALSE,Port);
>   end;
> 

I don't know anything about VP, so I dont' understand why it compiles
this except if you made a typemistake in the code above, but you are
declaring an array of POINTERS to DataRecord, not of the records
themself.
So you have to use DataFromFile[CurrentLine]^.Display;

Johan Blok




More information about the fpc-pascal mailing list