Previous Topic

Next Topic

Introductory Tutorial

..\\sdk\ctree.lowlevel\tutorials\lowlevel.c

This tutorial will take you through the basic use of the c-treeLowLevel C API.

Like all other examples in the c-tree tutorial series, this tutorial simplifies the creation and use of a database into four simple steps: Initialize(), Define(), Manage(), and You’re Done() !

Tutorial #1: Introductory - Simple Single Table

We wanted to keep this program as simple as possible. This program does the following:

  • Initialize() - Connects to the c-treeACE Database Engine.
  • Define() - Defines and creates a "customer master" (custmast) table/file.
  • Manage() - Adds a few rows/records; Reads the rows/records back from the database; displays the column/field content; and then deletes the rows/records.
  • Done() - Disconnects from c-treeACE Database Engine.

Note our simple mainline:

NINT main (NINT argc,pTEXT argv[])
{
	VOID db_create(void), db_init(void), database(void), db_close(void);
  printf("\nc-tree Plus(tm) Version 9\n\nSimple Low Level Function Example\n\n");

	/* You must always initialize c-tree before you use any of the functions. */
	/* Initialize the c-tree system */
	if (InitCTree(10,2,4))
		terminate("Could not initialize c-tree",-1);
		
	if (argc > 1)
		db_create();  /* create the database files    */
	db_init();        /* open the database files that are already created */
	database();       /* perform database routines    */
	db_close();       /* close the files, and any other ending stuff */
	return(0);        /* dummy to remove compiler warning */
}

We suggest opening the source code with your own editor.

Continue now to review these four steps.

In This Section

Init

Define

Manage

Done

Additional Resources