home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_122 / 9.ddi / IOSTRSR1.ZIP / OSTISCHR.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-10  |  1.8 KB  |  64 lines

  1. /*[]------------------------------------------------------------[]*/
  2. /*|                                                              |*/
  3. /*|     ostischr.cpp                                             |*/
  4. /*|                                                              |*/
  5. /*|     Class ostream                                            |*/
  6. /*|          ostream& ostream::operator<< ( signed char )        |*/
  7. /*|                                                              |*/
  8. /*[]------------------------------------------------------------[]*/
  9.  
  10. /*
  11.  *      C/C++ Run Time Library - Version 5.0
  12.  *
  13.  *      Copyright (c) 1990, 1992 by Borland International
  14.  *      All Rights Reserved.
  15.  *
  16.  */
  17.  
  18. #include <ioconfig.h>
  19. #include <iostream.h>
  20.  
  21. ostream _FAR & ostream::operator<< (signed char c)
  22. {
  23.     if( opfx() )
  24.         {
  25.         int pad = width(0) - 1;
  26.  
  27.         // pad on left (right-adjust) if needed -- the default case
  28.         if( ! (x_flags & (ios::left | ios::internal)))
  29.             {
  30.             while( --pad >= 0 )
  31.                 {
  32.                 if( bp->sputc(x_fill) == EOF )
  33.                     {
  34.                     setstate(ios::badbit);
  35.                     break;
  36.                     }
  37.                 }
  38.             }
  39.  
  40.         // output the data
  41.         if( ! fail() )
  42.             if( bp->sputc(c) == EOF )
  43.                 setstate(ios::badbit);
  44.  
  45.         // pad on right (left-adjust) if needed
  46.         if( ! fail()  &&  (x_flags & ios::left) )
  47.             {
  48.             while( --pad >= 0 )
  49.                 {
  50.                 if( bp->sputc(x_fill) == EOF )
  51.                     {
  52.                     setstate(ios::badbit);
  53.                     break;
  54.                     }
  55.                 }
  56.             }
  57.         }
  58.     osfx();
  59.  
  60.     return *this;
  61. }
  62.  
  63.  
  64.