home *** CD-ROM | disk | FTP | other *** search
/ CD Shareware Magazine 1996 December / CD_shareware_12-96.iso / DOS / Programa / CCDL122.ZIP / CLIBS / IO / FWRITE.C < prev    next >
Encoding:
C/C++ Source or Header  |  1996-08-08  |  443 b   |  20 lines

  1. #include <stdio.h>
  2. #include <time.h>
  3. #include <stdlib.h>
  4. #include <string.h>
  5. #include <libp.h>
  6.  
  7. int fwrite(char *buf, size_t size, size_t count, FILE *stream)
  8. {
  9.     int len = size * count,i;
  10.     if (stream->token != FILTOK)
  11.         return 0;
  12.     if (!(stream->flags & _F_WRIT)) {
  13.         stream->flags |= _F_ERR;
  14.         return 0;
  15.     }
  16.     for (i=0; i < len; i++)
  17.         if (_baseputc(*(unsigned char *)buf++,stream) == EOF)
  18.             return i / size;
  19.     return count;
  20. }