On 10 Jul 2001, at 18:24, Adam Naumowicz wrote:
Hello,
I have a basic question concerning strings and array memory representation in GPC. To my amusement I noticed that in the following program the string assigned to an array element cannot be then restored from the array itself. So probably an array of strings is not represented in memory just like an array of simple type, and cannot (?) be simply getmem-ed ?
program test; type NameStr=String[8]; shortarray=array[1..3] of NameStr;
var n:NameStr; a:^shortarray; i:integer;
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);"
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/