home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / crt / src / ostrchar.cpp < prev    next >
C/C++ Source or Header  |  1998-06-17  |  964b  |  37 lines

  1. /***
  2. * ostrchar.cpp - definitions for ostream class operator<<(char) functions.
  3. *
  4. *       Copyright (c) 1991-1997, Microsoft Corporation.  All rights reserved.
  5. *
  6. *Purpose:
  7. *       Contains the member function definitions for ostream operator<<(char).
  8. *
  9. *******************************************************************************/
  10.  
  11. #include <cruntime.h>
  12. #include <internal.h>
  13. #include <iostream.h>
  14. #pragma hdrstop
  15.  
  16. // note: called inline by char and signed char versions:
  17. ostream&  ostream::operator<<(unsigned char c)
  18. {
  19.     if (opfx())
  20.         {
  21.         if (x_width)
  22.             {
  23.             _WINSTATIC char outc[2];
  24.             outc[0] = c;
  25.             outc[1] = '\0';
  26.             writepad("",outc);
  27.             }
  28.         else if (bp->sputc(c)==EOF)
  29.             {
  30.             if (bp->overflow(c)==EOF)
  31.                 state |= (badbit|failbit);  // fatal error?
  32.             }
  33.         osfx();
  34.         }
  35.     return *this;
  36. }
  37.