When an application and/or process has completed operations with the database, it must release resources by closing the open files
Below is the code for db_close():
/********************************************************
* *
* db_close: close the data files and indexes. *
* *
********************************************************/
#ifdef PROTOTYPE
VOID db_close(void)
#else
VOID db_close()
#endif
{
if (CloseCtFile(INVENTDAT,0)) /* the second parameter is no longer used*/
func_error(INVENTDAT);
if (CloseCtFile(INVENTIDX,0))
func_error(INVENTIDX);
StopUser(); /* Terminate this user with server and/or free-up
* c-tree PLUS(tm) memory allocations.
* You can include this even if you are
* not sure if you will be using the server.
*/
fflush(stdout);
ctrt_exit(0);
}