Hiya all
It seems that there is a difference between the way that BP and GPC handle pChar parameters. In BP, pChars always seem to be passed by reference. In GPC, this is often the case, but is it always so? Why does the following program behave differently under BP and GPC?
PROGRAM TestStr;
{$ifdef ver70} USES STRINGS; {$else ver70} USES SYSTEM, STRINGS; {$X+} {$endif ver70}
Var p1,p2:pchar; s:string; Begin s := 'Fred is a good boy and a good father and uncle'+#0; p1 := StrNew (@s[1]); Writeln(p1); StrDispose(p1); if assigned(p1) then p2 := strnew(p1); Writeln(p2); {GPC writes the full string; BP writes "Fred"} StrDispose(p2); StrDispose(p2); {should cause a runtime error - but doesn't under GPC} End.
Best regards, The Chief -------- Dr. Abimbola A. Olowofoyeku (The African Chief) Email: laa12@keele.ac.uk Homepage: http://ourworld.compuserve.com/homepages/African_Chief/ Author of: Chief's Installer Pro 4.01 for Win16 and Win32: http://www.simtel.net/pub/simtelnet/win3/install/chief401.zip
Goodbyy fellows!
Plase remove me from the GPC mailinglist!
/Jakob :)
Jakob Heinemann