On 11 Jul 2001, at 11:21, Adam Naumowicz wrote:
[...]
begin getmem(a,3*sizeof(NameStr));
This is your problem. Use 'New' instead of 'getmem' - i.e., New (a, 3 * sizeof (NameStr)); or New (a, sizeof (shortarray)); or better still, just "New (a);"
Thanks for your answers. But I want my sources to stay BP/Delphi compatible...
Both BP and Delphi understand "New (a);".
I still don't know what is wrong with the getmem call. Maybe I should try this example with a newer compiler as Maurice says it works fine for him.
I have the latest snapshot of the compiler, and getmem does not work in this example.
It worked fine for me with BP, Delphi and FPC, but all those handle strings in somewhat different manner than GPC. Why is new better than getmem in this example ?
It is because of the format of GPC strings. Read: http://agnes.dida.physik.uni-essen.de/~gnu-pascal/gpc_37.html#SEC37
Best regards, The Chief --------- Prof. Abimbola Olowofoyeku (The African Chief) Author of Chief's Installer Pro for Win32 Email: African_Chief@bigfoot.com http://www.bigfoot.com/~african_chief/