Previous Topic

Next Topic

Init

First we need to open a connection to a database by providing the c-treeACE Database Engine with a user name, password and the database name.

Below is the code for Initialize():

/********************************************************
*                                                       *
* db_init:      Open the data files and indices. They   *
*               must have been already created. Most of *
*               the important parameters for the files  *
*               are set when the file was created.	     *
*                                                       *
********************************************************/
#ifdef PROTOTYPE
VOID db_init(void)
#else
VOID db_init()
#endif
{
	/* Open the data file */
	if (OpenCtFile(INVENTDAT,"invent.dat",ctVIRTUAL|ctSHARED))
		terminate("Could not open invent.dat",INVENTDAT);
		
	/* Open the index file */
	if (OpenCtFile(INVENTIDX,"invent.idx",ctVIRTUAL|ctSHARED))
		terminate("Could not open invent.idx",INVENTIDX);

	return;
}