1989-05-30 13:34:25 +00:00
|
|
|
/*
|
|
|
|
* fwrite.c - write a number of array elements on a file
|
|
|
|
*/
|
|
|
|
/* $Header$ */
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
size_t
|
|
|
|
fwrite(register const void *ptr, size_t size, size_t nmemb,
|
|
|
|
register FILE *stream)
|
|
|
|
{
|
|
|
|
unsigned s;
|
|
|
|
unsigned ndone = 0;
|
|
|
|
|
|
|
|
if (size)
|
|
|
|
while ( ndone < nmemb ) {
|
|
|
|
s = size;
|
|
|
|
do {
|
|
|
|
if (putc((int)*(unsigned char *)ptr, stream)
|
|
|
|
== EOF)
|
1989-06-26 10:37:05 +00:00
|
|
|
return ndone;
|
1989-05-30 13:34:25 +00:00
|
|
|
ptr++;
|
|
|
|
}
|
|
|
|
while (--s);
|
|
|
|
ndone++;
|
|
|
|
}
|
1989-06-26 10:37:05 +00:00
|
|
|
return ndone;
|
1989-05-30 13:34:25 +00:00
|
|
|
}
|