1989-12-18 14:40:54 +00:00
|
|
|
/*
|
|
|
|
* getw - read a word from a stream
|
|
|
|
*/
|
1994-06-24 14:02:31 +00:00
|
|
|
/* $Id$ */
|
1989-12-18 14:40:54 +00:00
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
int getw(register FILE *stream)
|
|
|
|
{
|
|
|
|
register int cnt = sizeof(int);
|
|
|
|
int w;
|
|
|
|
register char *p = (char *) &w;
|
|
|
|
|
|
|
|
while (cnt--) {
|
|
|
|
*p++ = getc(stream);
|
|
|
|
}
|
|
|
|
if (feof(stream) || ferror(stream)) return EOF;
|
|
|
|
return w;
|
|
|
|
}
|