Creating a dictionary and adding key, value pairs

The following example shows how to create the disk dictionary and add key- value pairs to it.

First a new dictionary is created with the name TestDict. A for loop adds key- value pairs with the data type TCollectibleLong.

      char * myDict = "TestDict";
      TAssoc* myAssoc;
      
      TDiskDictionary*  dict = new TDiskDictionary(myDict);
      
      for (long i=1, j=i+1; i <= 10; i++, j++) {
          TCollectibleLong key(i);
          TCollectibleLong val(j);
          dict->Add(key,val); 
      }

[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker