2005-04-21 16:53:53 +02:00
|
|
|
/*
|
|
|
|
* 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--) {
|
2010-07-06 14:08:22 +02:00
|
|
|
(void) putc(*p++, stream);
|
2005-04-21 16:53:53 +02:00
|
|
|
}
|
|
|
|
if (ferror(stream)) return EOF;
|
|
|
|
return w;
|
|
|
|
}
|