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.

43 lines
1021 B

  1. /***
  2. * ostrput.cpp - definitions for ostream classes put() and write() functions
  3. *
  4. * Copyright (c) 1991-2001, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. * Contains the member function definitions for ostream put() and write().
  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::put(unsigned char c)
  20. {
  21. if (opfx())
  22. {
  23. if (bp->sputc((int)c)==EOF)
  24. state |= (failbit|badbit);
  25. osfx();
  26. }
  27. return(*this);
  28. }
  29. // note: called inline by unsigned char * and signed char * versions:
  30. ostream& ostream::write(const char * s, int n)
  31. {
  32. if (opfx())
  33. {
  34. // Note: 'n' treated as unsigned
  35. if (bp->sputn(s,n)!=n)
  36. state |= (failbit|badbit);
  37. osfx();
  38. }
  39. return(*this);
  40. }