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.

39 lines
957 B

  1. /***
  2. * ostrptr.cpp - definitions for ostream operator<<(const void*) member function
  3. *
  4. * Copyright (c) 1991-2001, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. * Member function definition for ostream operator<<(const void*).
  8. *
  9. *Revision History:
  10. * 09-23-91 KRS Created. Split out from ostream.cxx for granularity.
  11. * 06-03-92 KRS CAV #1183: add 'const' to ptr output argument.
  12. * 06-14-95 CFW Comment cleanup.
  13. *
  14. *******************************************************************************/
  15. #include <cruntime.h>
  16. #include <internal.h>
  17. #include <stdio.h>
  18. #include <iostream.h>
  19. #pragma hdrstop
  20. ostream& ostream::operator<<(const void * ptr)
  21. {
  22. _WINSTATIC char obuffer[12];
  23. _WINSTATIC char fmt[4] = "%p";
  24. _WINSTATIC char leader[4] = "0x";
  25. if (opfx())
  26. {
  27. if (ptr)
  28. {
  29. if (x_flags & uppercase)
  30. leader[1] = 'X';
  31. }
  32. sprintf(obuffer,fmt,ptr);
  33. writepad(leader,obuffer);
  34. osfx();
  35. }
  36. return *this;
  37. }