[fpc-pascal] problem with array of string

Michael.VanCanneyt at Wisa.be Michael.VanCanneyt at Wisa.be
Mon Dec 20 22:34:07 CET 2004



On Mon, 20 Dec 2004, Dariusz Mazur wrote:

> I have problem with two dimension array of string
> 
> my program:
> 
> procedure testlinie;
> var
>     linie  : array[0..1,0..100] of shortstring;
>     i,ii : integer;
> begin
>    fillchar(linie,sizeof(linie),0);
>    for i := 0 to 1 do begin
>      for ii:= 1 to 10 do begin
>        linie[i,ii]:= linie[i,ii]+char(64+ii);
>        writeln(i:5,ii:5,linie[i,ii]) ;
>        
>      end;
>    end;
> end;
> 
> during execution output is:
> 0 1 A
> 0 2 B
> 0 3 C etc.
> 
> but should be:
> 0 1 A
> 0 2 AB
> 0 3  ABC
> 
> on Delphi all works OK.

I seriously doubt this:

home: >dcc testlinie.pp
Borland Delphi for Linux Version 14.5
Copyright (c) 1983,2002 Borland Software Corporation
testlinie.pp(22)
23 lines, 0.00 seconds, 23032 bytes code, 3088 bytes data.
home: >./testlinie
    0    1A
    0    2B
    0    3C
    0    4D
    0    5E
    0    6F
    0    7G
    0    8H
    0    9I
    0   10J
    1    1A
    1    2B
    1    3C
    1    4D
    1    5E
    1    6F

The FPC output is exactly the same.

Michael.




More information about the fpc-pascal mailing list