Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2011-06

TFPDataHashTable

3 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Joseph Montanez

I am tring to understand how to use TFPDataHashTable and upon using it I just manage to crash the application.

program hashdemo;
uses contnrs;
var
  HTable: TFPDataHashTable;
  Test: String;
  node: THTCustomNode;
begin
  Test := 'terr';
  HTable.create;
  HTable.add('test', @Test); { <-- Crashes here because its not initialised? }
  writeln('Hello!');
  node := HTable.find('test');
  writeln(node.Key);
end.
Joseph Montanez Web Developer Gorilla3D Design, Develop, Deploy
Michael Van Canneyt
to Joseph Montanez
Joseph Montanez wrote 14 lines
I am tring to understand how to use TFPDataHashTable and upon using it I just manage to crash the application. program hashdemo; uses contnrs; var HTable: TFPDataHashTable; Test: String; node: THTCustomNode; begin Test := 'terr'; HTable.create;

This should be

   HTable:=TFPDataHashTable.Create;

They are classes, not objects.

Show quoted text 18 lines
HTable.add('test', @Test); { <-- Crashes here because its not initialised? } writeln('Hello!'); node := HTable.find('test'); writeln(node.Key); end. -- Joseph Montanez Web Developer Gorilla3D Design, Develop, Deploy _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Claudio Lo Gaffo
to Joseph Montanez: I am tring to understand how to use TFPDataHashTable and upon using it I just manage to…
Joseph Montanez wrote 23 lines
I am tring to understand how to use TFPDataHashTable and upon using it I just manage to crash the application. program hashdemo; uses contnrs; var HTable: TFPDataHashTable; Test: String; node: THTCustomNode; begin Test := 'terr'; HTable.create; HTable.add('test', @Test); {<-- Crashes here because its not initialised? } writeln('Hello!'); node := HTable.find('test'); writeln(node.Key); end.
try Htable := TFPDataHashTable.Create;

Claudio