Listing 1 test.c

#include <d4base.h>

#define SAFETY_ON 1  /* d4create will return -1 if database already exists.. */
#define SAFETY_OFF 0 /* d4create will overwrite database if it exists... */


/* Declare Field Structure for database */

static FIELD FIELDS[] =
{
   /* Field Name,    Type,  Width,  Dec,    Offset */
     {"FIRST_NAME",   'C',     25,      0,      0   }, /* Char 25 */
     {"LAST_NAME",    'C',     25,      0,      0   }, /* Char 25 */
     {"COMPANY",      'C',     30,      0,      0   }, /* Char 30 */
     {"TELEPHONE",    'C',     12,      0,      0   }, /* Char 12 */
     {"LAST_SALE",    'N',     12,      2,      0   }, /* Numeric */
     {"LAST_DATE",    'D',      8,      0,      0   }, /* Date    */
     {"GOOD_CUST",    'L',      1,      0,      0   }  /* Logical */
} ;

int create_name( void );  /* Prototype for CUSTOMERS.DBF creation function */

main()
{
   int rc;             /* Return Code */
   rc = create_name();
   printf("\n rc return code was %d",rc);
   return;
}

int create_name( void )
{
   int rc;           /* Return Code */

   rc = d4create("CUSTOMER.DBF",7,FIELDS,SAFETY_OFF);
   return rc;
}