Whats wrong?!?

Wed, 11 Jun 1997 23:42:14 +0800


The following does not work!?!? Is it a problem on my behalf or is it a GPC
feature! :-)


Function Asciiz2Str(Var InStr:{Packed} Array Of Char) : String;
    Var
        OutStr : String[255];
        Index  : Integer;
    Begin
        OutStr := '';
        Index  := 0;
        While (Index <= 255) And (InStr[Index] <> #0) Do
            Begin
                OutStr := OutStr + InStr[Index];
                Inc(Index);
            End;

        Asciiz2Str := OutStr;
    End;

Var
    Text : Packed Array[0..19] Of Char;
Begin
    Text := 'Hello Word!'+#0+#0+#0+#0+#0+#0+#0+#0+#0+#0;

    WriteLn('*',Text,'*');          { Prints out with padded #0      }

    WriteLn('*',Trim(Text),'*');    { Also prints out with padded #0 }

    WriteLn('*',Asciiz2Str(Text),'*');           { Segment Violation }
End.


Im using GPC 970420 for DJGPP 2.01. Im not very happy about the the
Segmentation Violation. Also, it would be nice if the Trim cut out the
trailing #0s, but this might break some programs... The first WriteLn is OK.

Bye (Im having trouble coming up with unique greetings :-)
 ________________________
|  _)        | |             e-mail: bernie@icenet.com.au
|___)ernhard |_|schirren             ptschirrenb@cc.curtin.edu.au
                             www:    www.geocities.com/CollegePark/Quad/8070/


Bernhard Tschirren (bernie@icenet.com.au)

HTML conversion by Lluís de Yzaguirre i Maura
Institut de Lingüística Aplicada - Universitat "Pompeu Fabra"
e-mail: de_yza@upf.es