Rev | Line | |
---|
[9] | 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 |
|
---|
| 8 | size_t
|
---|
| 9 | fwrite(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.