[fpc-pascal]Classes/Objects/Pointers
James Mills
prologic at prologitech.com
Mon Feb 10 08:13:14 CET 2003
Hi all,
Sorry to bother you again, can't seem to see what I'm doing wrong it's
the same as my dynamic code for strings...
var
nicks: PNick;
nNicks: Integer;
procedure initialiseDataNicks;
procedure addNick(data: String);
procedure updateNick(index: Integer; nick: pNick);
function getNick(nick: String; var index: Integer): pNick;
procedure delNick(nick: String);
implementation
procedure initialiseDataNicks;
begin
nNicks := 0;
end;
procedure addNick(data: String);
var
tokens: PTokenizer;
nick: String;
hops: Integer;
signon: longInt;
ident: String;
host: String;
server: String;
unused: String;
name: String;
begin
tokens := new(PTokenizer, init(data));
nick := tokens^.nextToken;
hops := strToInt(tokens^.nextToken);
signon := strToInt(tokens^.nextToken);
ident := tokens^.nextToken;
host := tokens^.nextToken;
server := tokens^.nextToken;
unused := tokens^.nextToken;
name := tokens^.nextToken;
getMem(nicks, sizeOf(TNick) * nNicks);
50: nicks := new(PNick, init(nick, hops, signon, ident, host, server, unused, name));
inc(nNicks);
dispose(tokens, deInit);
end;
...
$ fpc datanicks.pas
Free Pascal Compiler version 1.0.6 [2002/08/10] for i386
Copyright (c) 1993-2002 by Florian Klaempfl
Target OS: Linux for i386
Compiling datanicks.pas
datanicks.pas(50,19) Error: Incompatible types: got "PNICK" expected
"TNICK"
datanicks.pas(58,16) Error: Illegal qualifier
datanicks.pas(58,25) Error: Illegal qualifier
datanicks.pas(67,26) Error: Illegal qualifier
datanicks.pas(70,26) Error: Illegal qualifier
datanicks.pas(83,31) Error: Illegal qualifier
datanicks.pas(100) Fatal: There were 6 errors compiling module, stopping
If I can fix that error at line 50, I'm sure I can fix the others.
Obviously trying to create arrays of type TNick on the fly, but am a
little confused here...
thanks for your help
James
More information about the fpc-pascal
mailing list