home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c065 / 1.ddi / CLIB1.ZIP / GETW.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-06-07  |  1.3 KB  |  44 lines

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