home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_144 / 1.ddi / CLIBSRC1.ZIP / PUTW.C < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-10  |  1.3 KB  |  47 lines

  1. /*-----------------------------------------------------------------------*
  2.  * filename - putw.c
  3.  *
  4.  * function(s)
  5.  *        putw - puts word on 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            putw - puts a character or word on a stream
  22.  
  23. Usage           #include <stdio.h>
  24.                 int putw(int w, FILE *stream);
  25.  
  26. Prototype in    stdio.h
  27.  
  28. Description     putw outputs the integer w to the output stream. putw neither
  29.                 expects nor causes special alignment in the file.
  30.  
  31. Return value    On success putw returns the integer w.
  32.  
  33.                 On error, putw returns EOF.
  34.  
  35.                 Since EOF is a legitimate integer, ferror
  36.                 should be used to detect errors with putw.
  37.  
  38. *---------------------------------------------------------------------*/
  39. int _FARFUNC putw(int w, FILE *fp)
  40. {
  41.         if (putc(*((unsigned char *)&(w)), fp) != EOF)
  42.                 if (putc(*((unsigned char *)&(w) + 1), fp) != EOF)
  43.                         return(w);
  44.  
  45.         return EOF;
  46. }
  47.