home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_100 / 163_01 / fwrite.c < prev    next >
Text File  |  1988-01-31  |  640b  |  19 lines

  1. /*
  2. ** binary write to a stream file
  3. ** note that ioctl should be used to reset CRMOD before using this function
  4. */
  5. #define FILE int
  6. #define EOF (-1)
  7. extern int fputc();
  8.  
  9. fwrite(ptr, size, nitems, stream) char *ptr; int size, nitems, *stream; {
  10.   int icount, bcount;
  11.   icount = nitems;
  12.   while(icount--) {
  13.     bcount = size;
  14.     while(bcount--)
  15.       if(fputc(*ptr++, stream) == EOF) return 0;
  16.     }
  17.   return nitems;
  18.   }
  19.