home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_144 / 1.ddi / CLIBSRC.ZIP / GETW.C < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-10  |  1023 b   |  43 lines

  1. /*-----------------------------------------------------------------------*
  2.  * filename - getw.c
  3.  *
  4.  * function(s)
  5.  *        getw - gets a word from a stream
  6.  *-----------------------------------------------------------------------*/
  7.  
  8. /*
  9.  *      C/C++ Run Time Library - Version 5.0
  10.  *
  11.  *      Copyright (c) 1987, 1992 by Borland International
  12.  *      All Rights Reserved.
  13.  *
  14.  */
  15.  
  16.  
  17. #include <stdio.h>
  18.  
  19. /*---------------------------------------------------------------------*
  20.  
  21. Name            getw - gets a word from a stream
  22.  
  23. Usage           #include <stdio.h>
  24.                 int getw(FILE * stream);
  25.  
  26. Prototype in    stdio.h
  27.  
  28. Description     see getc
  29.  
  30. *---------------------------------------------------------------------*/
  31. int getw(FILE *fp)
  32. {
  33.         int     c, res;
  34.  
  35.         if ((c = getc(fp)) != EOF)
  36.                 if ((res = getc(fp)) == EOF)
  37.                         c = EOF;
  38.                 else
  39.                         (*((char *)&(c) + 1)) = res;
  40.  
  41.         return(c);
  42. }
  43.