Sample Program

A very simple use of the BTree API is shown below. This program creates a BTree file and inserts one key ("akey") with the value of 99. Error checking has been omitted for clarity.

        #include "btree.h"
        int main(int argc, char *argv[])
        {
            BTA *btfile;
            btinit();
            btfile = btcrt("test_db",0,FALSE);
            binsky(btfile,"akey",99);
            btcls(btfile);
            return 0;
        }
      

If the program source resides in the bt directory, the command to compile and link the program will be (assuming no Large File Support):

        gcc -o simple simple.c -Iinc -Llib -lbt
      

A couple of additional sample programs, using the BT Library API, can be found the the samples sub-directory. A Makefile is provided to build the sample programs. The makefile assumes it will be run in the samples directory.