Creating a B Tree File

#include "btree.h"

BTA* btcrt(char* fid, int nkeys, int shared);

The btcrt function will create and initialise a new B Tree file. The parameter fid must be set to the name of the file to create. The nkeys defines the maximum number of keys that can be stored in the B Tree. This parameter should always be set to 0 for those operating systems, such as UNIX, that support dynamic file growth. The parameter shared should be set to 0 to disallow shared access to the newly created B Tree, or non-zero to allow shared access.

btcrt will return a pointer to the BT activation context for the newly opened file (BTA*), or NULL in the case of an error. To determine the cause of an error, invoke the btcerr function.

If the B Tree index file has been successfully created, the default root is selected, the file becomes the in-use B Tree file and is ready for further operations.

WARNING: The btcrt function will unconditionally create a new file, even if a file of the same name already exists.