ack/lang/cem/libcc.ansi/core/stdio/fwrite.c
David Given 3131dc9915 Partially working port of stdio to CP/M. I'm not sure this will work; it's
getting way too complicated (stdio is horribly subtle). I think I need to
rethink things.
2019-06-15 22:22:01 +02:00

35 lines
486 B
C

/*
* fwrite.c - write a number of array elements on a file
*/
/* $Id$ */
#include <stdio.h>
#if ACKCONF_WANT_STDIO
size_t
fwrite(const void* ptr, size_t size, size_t nmemb,
register FILE* stream)
{
register const unsigned char* cp = ptr;
register size_t s;
size_t ndone = 0;
if (size)
while (ndone < nmemb)
{
s = size;
do
{
if (putc((int)*cp, stream)
== EOF)
return ndone;
cp++;
} while (--s);
ndone++;
}
return ndone;
}
#endif