Tools.h++ Manual

11-6 104011 Tandem Computers Incorporated
11
And here is how you could open the three B-Trees:
#include <rw/disktree.h>
#include <rw/filemgr.h>
main()
{
RWoffset rootArray[3]; // Location of the tree roots
RWBTreeOnDisk* treeArray[3];// Pointers to the RWBTreeOnDisks
RWFileManager fm(“index.dat”);
fm.SeekTo(fm.start()); // Recover locations of root nodes
fm.Read(rootArray, 3);
for (int itree=0; itree<3; itree++)
{
// Initialize the three trees:
treeArray[itree] = new RWBTreeOnDisk(fm,
autoCreate,// Will read old tree
16, // Key length
FALSE, // Do not ignore nulls
rootArray[itree] // Location of root
);
}
return 0;
}