home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_08_04 / 8n04110a < prev    next >
Text File  |  1990-03-20  |  1KB  |  41 lines

  1. *****Listing 1*****
  2.  
  3. #include <d4base.h>
  4.  
  5. #define SAFETY_ON  1   /* d4create will return -1 if database already exists.. */
  6. #define SAFETY_OFF 0   /* d4create will overwrite database if it exists...     */
  7.  
  8.  
  9. /* Declare Field Structure for database */
  10.  
  11. static FIELD FIELDS[] =
  12. {
  13.    /* Field Name,       Type,    Width,   Dec,   Offset */
  14.       {"FIRST_NAME",     'C',       25,       0,     0   }, /* Char 25 */
  15.       {"LAST_NAME",      'C',       25,       0,     0   }, /* Char 25 */
  16.       {"COMPANY",        'C',       30,       0,     0   }, /* Char 30 */
  17.       {"TELEPHONE",      'C',       12,       0,     0   }, /* Char 12 */
  18.       {"LAST_SALE",      'N',       12,       2,     0   }, /* Numeric */
  19.       {"LAST_DATE",      'D',        8,       0,     0   }, /* Date    */
  20.       {"GOOD_CUST",      'L',        1,       0,     0   }  /* Logical */
  21. } ;
  22.  
  23. int create_name( void );    /* Prototype for CUSTOMERS.DBF creation function */
  24.  
  25. main()
  26. {
  27.    int rc;                /* Return Code */
  28.    rc = create_name();
  29.    printf("\n rc return code was %d",rc);
  30.    return;
  31. }
  32.  
  33. int create_name( void )
  34. {
  35.    int rc;            /* Return Code */
  36.  
  37.    rc = d4create("CUSTOMER.DBF",7,FIELDS,SAFETY_OFF);
  38.    return rc;
  39. }
  40.  
  41.