getw.c 239 B

12345678910111213141516
  1. /* $Id$ */
  2. #include <stdio.h>
  3. int getw(iop)
  4. register FILE *iop;
  5. {
  6. register int cnt = sizeof(int);
  7. int w;
  8. register char *p = (char *) &w;
  9. while (cnt--) {
  10. *p++ = getc(iop);
  11. }
  12. if (feof(iop) || ferror(iop)) return EOF;
  13. return w;
  14. }