Posted by Martin Knappe
var p: Pointer; i: Integer; content: TStrings; entry: TEntry; begin p := nil; content := TStringList.Create(); content.LoadFromFile(FileName); if content.Count mod 2 = 0 then begin i := 0; while i < content.Count do begin entry := TEntry.Create(); if p = Addr(entry) then ShowMessage('Same address!!!'); //some instruction Inc(i); //some instruction Inc(i); self.Add(Addr(entry)); p := Addr(entry); end; ...
If you execute that in a program you always get the 'Same address!!!' message. This is not what I intend. I obviously intend to create content.Count/2 objects and have them all added to my list.
is wrong with that code??? Please help,
Related Articles and Replies
DelphiLand Discussion Forum