source: trunk/minix/lib/other/putw.c@ 15

Last change on this file since 15 was 9, checked in by Mattia Monga, 14 years ago

Minix 3.1.2a

File size: 409 bytes
Line 
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
10int
11putw(w, stream)
12int w;
13register 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.