source: trunk/minix/lib/other/getw.c@ 9

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

Minix 3.1.2a

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