[fpc-pascal]FPC Problem with reAllocMem...

Anton Tichawa anton.tichawa at chello.at
Tue Feb 11 12:42:29 CET 2003


Hello, James!

You have to allocate memory BEFORE storing data there, i. e. you should 
change datanick.pas lines about 63 .. 66 from:

  nicks[nNicks] := TNick.init(nick, hops, signon, ident, host,
    server, unused, name);
  {getMem(nicks, sizeOf(TNick) * nNicks);}
  inc(nNicks);
  reAllocMem(nicks, sizeOf(TNick) * nNicks);

to

  {getMem(nicks, sizeOf(TNick) * nNicks);}
  inc(nNicks);
  reAllocMem(nicks, sizeOf(TNick) * nNicks);
  nicks[nNicks - 1] := TNick.init(nick, hops, signon, ident, host,
    server, unused, name);

Note that the storage index changed to nNicks - 1.

HTH

Anton Tichawa.


----------

"Adas Methode war, wie sich zeigen wird, Tagträume in offenbar korrekte 
Berechnungen einzuweben."

Doris Langley Moore: Ada, Countess of Lovelace (London 1977).

----------

Anton Tichawa
Volkertstrasse 19 / 20
A-1020 Wien
mobil: +43 664 52 07 907
email: anton.tichawa at chello.at

----------



More information about the fpc-pascal mailing list