home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 3 / 3650 / getcount.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-07-17  |  405 b   |  22 lines

  1. /*
  2.  * get_count.c  Brian Rice  rice@dg-rtp.dg.com  1989
  3.  * This routine is part of the shop package.
  4.  * It takes advantage of the fact that the first sizeof(long) bytes
  5.  * in the file named by f are a long which gives the number of
  6.  * items in that file.
  7.  */
  8. #include <stdio.h>
  9.  
  10. long int get_count(f)
  11. FILE *f;
  12. {
  13.     long int c = 0L;
  14.  
  15.         rewind(f);
  16.     (void) fread(&c,sizeof c,1,f);
  17.  
  18.         return c;
  19. }
  20.  
  21.  
  22.