home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / dos / database / nyisam / initism.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-05-07  |  1.7 KB  |  69 lines

  1. /* File: initism2.c
  2. /* Copyright (c) 1994 by John Gambini
  3. */
  4.  
  5. #include "ism.h"
  6. #include "compudex.h"    
  7. #include "screen.h"
  8.  
  9. void InitISAM()
  10. {
  11.     int wMaint, rc, w = 1, x, y, a, fhdl;
  12.     int top = 4, left = 5, width = 47, depth = 13;
  13.     char buff[80];
  14.  
  15.     Screen( &wMaint, GET_CURSOR_ABS, &y, &x, &a );
  16.  
  17.     Screen( &wMaint, SET_CURSOR_TYPE, INVISIBLE );
  18.  
  19.     Screen( &wMaint, CREATE_WINDOW, top, left, width, depth, 0x74, 0 );
  20.  
  21.     Screen( &wMaint, PUT_STRING, 0, 9," Create Name And Address File ", 0x74 );
  22.  
  23.     Screen( &wMaint, PUT_STRING, w, 2,"Creating Name and Address File.......", 0x70 );
  24.  
  25.     Screen( &wMaint, OPEN_WINDOW, 1 );
  26.  
  27.     fhdl = ISMCreate( MAILLST, sizeof( MAIL_REC ) );
  28.  
  29.     if( fhdl == ERROR )
  30.     {
  31.         w+=2;
  32.         Screen( &wMaint, PUT_STRING, w, 2, "ERROR: Could not create ISAM file \"maillst\".", 0x70 );
  33.         w++;
  34.         Screen( &wMaint, PUT_STRING, w, 2, "This may be because it already exists.", 0x70 );
  35.     }
  36.     else
  37.     {
  38.         w+=2;
  39.         Screen( &wMaint, PUT_STRING, w, 2, "ISAM File Creation succesful.", 0x70 );
  40.         rc = ISMClose( fhdl );
  41.         if( rc == ERROR )
  42.         {
  43.             w+=2;
  44.             Screen( &wMaint, PUT_STRING, w, 2, "A system error has occurred while attempting", 0x70 );
  45.             w+=2;
  46.             Screen( &wMaint, PUT_STRING, w, 2, "to close the ISAM file.", 0x07 );
  47.             sprintf( buff, "System Error = %d", ismerr.syserr );
  48.             w+=2;
  49.             Screen( &wMaint, PUT_STRING, w, 2, buff, 0x70 );
  50.         }
  51.     }
  52.  
  53.     w+=2;
  54.     Screen( &wMaint, PUT_STRING, w, 2, "Press Any Key To Continue", 0x70 );
  55.  
  56.     Screen( &wMaint, REFRESH_WINDOW_ABS, top, left, width, depth );
  57.  
  58.     Screen( &wMaint, SET_CURSOR, w, 29 );
  59.     Screen( &wMaint, SET_CURSOR_TYPE, NORMAL );
  60.  
  61.     getch();
  62.  
  63.     Screen( &wMaint, CLOSE_WINDOW );
  64.  
  65.     Screen( &wMaint, DESTROY_WINDOW );
  66.  
  67.     Screen( &wMaint, SET_CURSOR_ABS, y, x, a );
  68. }
  69.