ack/lang/cem/libcc.ansi/core/stdio/getw.c
2018-06-22 22:20:02 +02:00

22 lines
290 B
C

/*
* getw - read a word from a stream
*/
/* $Id$ */
#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;
}