home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0010 - 0019 / ibm0010-0019 / ibm0010.tar / ibm0010 / CODE4-1.ZIP / SOURCE.ZIP / D4RECCOU.C < prev    next >
Encoding:
C/C++ Source or Header  |  1989-10-14  |  732 b   |  37 lines

  1.  
  2. /*  d4reccount.c   (c)Copyright Sequiter Software Inc., 1987, 1988, 1989.  All rights reserved.
  3.  
  4.     Returns the number of records in the database.
  5.     Returns
  6.        >= 0  The number of records in the database.
  7.      -1  Error
  8. */
  9.  
  10. #include "d4base.h"
  11. #include "u4error.h"
  12. #ifndef UNIX
  13.    #include <io.h>
  14. #endif
  15.  
  16. extern  BASE   *v4base ;
  17. extern  int     v4cur_base ;
  18.  
  19.  
  20. long d4reccount()
  21. {
  22.    BASE  *base_ptr ;
  23.    long   len ;
  24.  
  25.    if ( v4cur_base < 0 )  return -1L ;
  26.  
  27.    base_ptr =  v4base+ v4cur_base ;
  28.  
  29.    if ( (len =  filelength(base_ptr->dos_file)) < 0L) 
  30.    {
  31.       u4error( E_INTERNAL, (char *) 0 ) ;
  32.       return -1L ;
  33.    }
  34.  
  35.    return ( (len-base_ptr->header_len)/ base_ptr->buffer_len ) ;
  36. }
  37.