Leaked source code of windows server 2003
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.

70 lines
1.4 KiB

  1. /***
  2. * ostream1.cpp - definitions for ostream class non-core member functions
  3. *
  4. * Copyright (c) 1991-2001, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. * Contains the non-core member function definitions for ostream class.
  8. *
  9. *Revision History:
  10. * 07-01-91 KRS Created. Split out from ostream.cxx for granularity.
  11. * 11-20-91 KRS Make operator= inline.
  12. * 03-30-92 KRS Add multithread locks.
  13. * 06-14-95 CFW Comment cleanup.
  14. *
  15. *******************************************************************************/
  16. #include <cruntime.h>
  17. #include <internal.h>
  18. #include <iostream.h>
  19. #pragma hdrstop
  20. ostream& ostream::seekp(streampos _strmp)
  21. {
  22. lockbuf();
  23. if (bp->seekpos(_strmp, ios::out)==EOF)
  24. clear(state | failbit);
  25. unlockbuf();
  26. return(*this);
  27. }
  28. ostream& ostream::seekp(streamoff _strmf, seek_dir _sd)
  29. {
  30. lockbuf();
  31. if (bp->seekoff(_strmf, _sd, ios::out)==EOF)
  32. clear(state | failbit);
  33. unlockbuf();
  34. return(*this);
  35. }
  36. streampos ostream::tellp()
  37. {
  38. streampos retval;
  39. lockbuf();
  40. if ((retval=bp->seekoff(streamoff(0), ios::cur, ios::out))==EOF)
  41. clear(state | failbit);
  42. unlockbuf();
  43. return(retval);
  44. }
  45. ostream& ostream::operator<<(streambuf * instm)
  46. {
  47. int c;
  48. if (opfx())
  49. {
  50. while ((c=instm->sbumpc())!=EOF)
  51. if (bp->sputc(c) == EOF)
  52. {
  53. state |= failbit;
  54. break;
  55. }
  56. osfx();
  57. }
  58. return *this;
  59. }