source: trunk/minix/lib/stdio/fwrite.c@ 11

Last change on this file since 11 was 9, checked in by Mattia Monga, 14 years ago

Minix 3.1.2a

File size: 534 bytes
Line 
1/*
2 * fwrite.c - write a number of array elements on a file
3 */
4/* $Header: /cvsup/minix/src/lib/stdio/fwrite.c,v 1.1.1.1 2005/04/21 14:56:35 beng Exp $ */
5
6#include <stdio.h>
7
8size_t
9fwrite(const void *ptr, size_t size, size_t nmemb,
10 register FILE *stream)
11{
12 register const unsigned char *cp = ptr;
13 register size_t s;
14 size_t ndone = 0;
15
16 if (size)
17 while ( ndone < nmemb ) {
18 s = size;
19 do {
20 if (putc((int)*cp, stream)
21 == EOF)
22 return ndone;
23 cp++;
24 }
25 while (--s);
26 ndone++;
27 }
28 return ndone;
29}
Note: See TracBrowser for help on using the repository browser.