minix/lib/other/putw.c
2005-04-21 14:53:53 +00:00

23 lines
334 B
C
Executable file

/*
* putw - write an word on a stream
*/
/* $Header$ */
#include <stdio.h>
_PROTOTYPE(int putw, (int w, FILE *stream ));
int
putw(w, stream)
int w;
register FILE *stream;
{
register int cnt = sizeof(int);
register char *p = (char *) &w;
while (cnt--) {
putc(*p++, stream);
}
if (ferror(stream)) return EOF;
return w;
}