CStrings/PChars

Tue, 17 Jun 1997 16:18:14 +0200 (MET DST)


According to The African Chief:
> 
> Great! Now one last thing about pChars - can you make
> them type-compatible with zero-based arrays of Char?

It seems to work already ... my GPC just compiled:


    program foobar;

    {$X+}

    function foo ( p : pChar ) : pChar;
    Begin
        foo := succ ( p, 2 );
    End;

    Var
      x : array [ 0..4 ] of Char value 'xyOK'#0;

    Begin
        writeln ( foo ( x ) );
    End.


(Note that the (*$X+*) directive is needed to enable both
pointer arithmetics and `pChar's being treated as Strings.)

Greetings,

    Peter

 Dipl.-Phys. Peter Gerwinski, Essen, Germany, free physicist and programmer
peter.gerwinski@uni-essen.de - http://home.pages.de/~peter.gerwinski/ [970201]
 maintainer GNU Pascal [970510] - http://home.pages.de/~gnu-pascal/ [970125]


Peter Gerwinski (peter@agnes.dida.physik.uni-essen.de)

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