Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
944 B

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