Initial revision
This commit is contained in:
28
lang/cem/libcc.ansi/stdio/fwrite.c
Normal file
28
lang/cem/libcc.ansi/stdio/fwrite.c
Normal file
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* 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)
|
||||
return(ndone);
|
||||
ptr++;
|
||||
}
|
||||
while (--s);
|
||||
ndone++;
|
||||
}
|
||||
return(ndone);
|
||||
}
|
||||
Reference in New Issue
Block a user