home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / database / dbase_c.zip / DBASE_C.LBR / DBCLOSE.C < prev    next >
Text File  |  1989-03-20  |  896b  |  24 lines

  1. #include  "libc.h"
  2. #include  "dbase.h"
  3.  
  4.  
  5. /***************************************************************
  6. *  db_close(db_ptr) closes the dbase file pointed to by db_ptr *
  7. * if the file has been changed, dbclose updates the dbase head-*
  8. * er before closing the file.  Any  errors are  passed back to *
  9. * the calling routine.                                         *
  10. ***************************************************************/
  11. db_close(db_ptr)
  12.    DBASE_FILE  *db_ptr ;
  13.    {int        inptr ;
  14.    
  15.    inptr = db_ptr->file_ptr ;         /* save the file pointer */
  16.    
  17.    /*----- Update the file description block if required -----*/
  18.    if( db_ptr->chng_ind == TRUE ) {
  19.       lseek(db_ptr->file_ptr,0L,0) ;
  20.       write(db_ptr->file_ptr,db_ptr,DB_HDR_SZ) ;
  21.    } 
  22.    return( close(inptr) ) ;                        /* save the file and return */
  23. }
  24.