Whats wrong?!?_(re)
Tue, 17 Jun 1997 11:33:54 +0100 (BST)
On Tue, 17 Jun 1997 02:11:17 +0200 (MET DST) Peter Gerwinski
wrote:
>According to Frank Heckenbach:
>>
>> Ooops, can't gpc write PChars at all? The following doesn't work:
>>
>> program x;
>> {$x+}
>> var a:PChar;
>> begin
>> writeln(a)
>> end.
>
>Fixed.
>
>> Similarly, the following compiles with BP, but not with gpc:
>>
>> program x;
>> {$x+}
>> var a:PChar;
>> begin
>> a:='Test' {in BP: assign the address of the 0-terminated string 'Test'#0
>> (stored somewhere statically) to a}
>> end.
>
>Fixed.
Great! Now one last thing about pChars - can you make
them type-compatible with zero-based arrays of Char?
This is the case with BP - so that any function/procedure
that takes a pChar as a parameter will accept a zero-based
array of Char as well - thanks!
e.g.,
program foobar;
uses
strings;
{$W-}
function foo ( p : pChar ) : pChar;
Begin
writeln ( p );
foo := strlen ( p );
End;
Var
x : array [ 0..64 ] of Char;
Begin
strcopy ( x, 'Dr. Chief' );
writeln ( foo ( x ) );
End.
Best regards, The Chief
Dr Abimbola A. Olowofoyeku (The African Chief, and the Great Elephant)
Author of: Chief's Installer Pro v3.60 for Win16 and Win32.
Homepage: http://ourworld.compuserve.com/homepages/African_Chief/
E-mail: laa12@cc.keele.ac.uk
The African Chief (laa12@cc.keele.ac.uk)
HTML conversion by Lluís de Yzaguirre i Maura
Institut de Lingüística Aplicada -
Universitat "Pompeu Fabra"
e-mail: de_yza@upf.es