summaryrefslogtreecommitdiffstats
path: root/private/crt32/iostream/ostrulng.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'private/crt32/iostream/ostrulng.cxx')
-rw-r--r--private/crt32/iostream/ostrulng.cxx55
1 files changed, 55 insertions, 0 deletions
diff --git a/private/crt32/iostream/ostrulng.cxx b/private/crt32/iostream/ostrulng.cxx
new file mode 100644
index 000000000..d09a5c9de
--- /dev/null
+++ b/private/crt32/iostream/ostrulng.cxx
@@ -0,0 +1,55 @@
+/***
+* ostrulng.cxx - definitions for ostream class operator<<(unsigned long) funct
+*
+* Copyright (c) 1991-1992, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* Contains the member function definition for ostream
+* operator<<(unsigned long).
+*
+*Revision History:
+* 09-23-91 KRS Created. Split out from ostream.cxx for granularity.
+*
+*******************************************************************************/
+
+#include <cruntime.h>
+#include <internal.h>
+#include <stdio.h>
+#include <iostream.h>
+#pragma hdrstop
+
+ostream& ostream::operator<<(unsigned long n)
+{
+_WINSTATIC char obuffer[12];
+_WINSTATIC char fmt[4] = "%lu";
+_WINSTATIC char leader[4] = "\0\0";
+ if (opfx()) {
+ if (n)
+ {
+ if (x_flags & (hex|oct))
+ {
+ if (x_flags & hex)
+ {
+ if (x_flags & uppercase)
+ fmt[2] = 'X';
+ else
+ fmt[2] = 'x';
+ leader[1] = fmt[2]; // 0x or 0X (or \0X)
+ }
+ else
+ fmt[2] = 'o';
+ if (x_flags & showbase)
+ leader[0] = '0';
+ }
+ else if (x_flags & showpos)
+ {
+ leader[0] = '+';
+ }
+ }
+ sprintf(obuffer,fmt,n);
+ writepad(leader,obuffer);
+ osfx();
+ }
+ return *this;
+
+}