home *** CD-ROM | disk | FTP | other *** search
/ Big Green CD 8 / BGCD_8_Dev.iso / NEXTSTEP / UNIX / Web / Utilities / wwwcount-2.3 / combine / rddata.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-05-02  |  972 b   |  75 lines

  1. /*
  2.  *    Read_Data()    -    Reads data from an image file
  3.  *
  4.  *    RCS:
  5.  *        $Revision: 2.3 $
  6.  *        $Date: 1996/05/03 02:21:34 $
  7.  *
  8.  *    Security:
  9.  *        Unclassified
  10.  *
  11.  *    Description:
  12.  *        this function reads data from a gray scale image file
  13.  *
  14.  *    Input Parameters:
  15.  *        type    identifier    description
  16.  *
  17.  *        text
  18.  *
  19.  *    Output Parameters:
  20.  *        type    identifier    description
  21.  *
  22.  *        text
  23.  *
  24.  *    Return Values:
  25.  *        value    description
  26.  *        0        on success;
  27.  *        1        on failure
  28.  *
  29.  *    Side Effects:
  30.  *        text
  31.  *
  32.  *    Limitations and Comments:
  33.  *        text
  34.  *
  35.  *    Development History:
  36.  *        when    who        why
  37.  *        8/31/93, mm, first cut
  38.  */
  39.  
  40. #include "combine.h"
  41.  
  42. int Read_Data (data, size, number_items,file)
  43.  
  44. char
  45.     *data;
  46.  
  47. int size,
  48.     number_items;
  49.  
  50. FILE
  51.     *file;
  52. {
  53.     int
  54.         rc=0;
  55.  
  56.     size*=number_items;
  57.  
  58.     while (size > 0)
  59.     {
  60.         number_items = fread(data,1,size,file);
  61.  
  62.         if (number_items <= 0)    /* Error */
  63.         {
  64.             rc=1;
  65.             goto ExitProcessing;
  66.         }    
  67.  
  68.     size-= number_items;
  69.     data+= number_items;
  70.     }
  71.  
  72. ExitProcessing:
  73.     return(rc);
  74. }
  75.