Rev | Line | |
---|
[9] | 1 | /*
|
---|
| 2 | * putw - write an word on a stream
|
---|
| 3 | */
|
---|
| 4 | /* $Header: /cvsup/minix/src/lib/other/putw.c,v 1.1.1.1 2005/04/21 14:56:27 beng Exp $ */
|
---|
| 5 |
|
---|
| 6 | #include <stdio.h>
|
---|
| 7 |
|
---|
| 8 | _PROTOTYPE(int putw, (int w, FILE *stream ));
|
---|
| 9 |
|
---|
| 10 | int
|
---|
| 11 | putw(w, stream)
|
---|
| 12 | int w;
|
---|
| 13 | register FILE *stream;
|
---|
| 14 | {
|
---|
| 15 | register int cnt = sizeof(int);
|
---|
| 16 | register char *p = (char *) &w;
|
---|
| 17 |
|
---|
| 18 | while (cnt--) {
|
---|
| 19 | putc(*p++, stream);
|
---|
| 20 | }
|
---|
| 21 | if (ferror(stream)) return EOF;
|
---|
| 22 | return w;
|
---|
| 23 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.