Category : C++ Source Code
Archive   : VCCRT1.ZIP
Filename : OSTRUSHT.CXX

 
Output of file : OSTRUSHT.CXX contained in archive : VCCRT1.ZIP
/***
* ostrusht.cxx - definition for ostream class operator<<(unsigned short) funct
*
* Copyright (c) 1991-1992, Microsoft Corporation. All rights reserved.
*
*Purpose:
* Contains the member function definition for ostream
* operator<<(unsigned short).
*
*******************************************************************************/

#include
#include
#include
#include
#pragma hdrstop

ostream& ostream::operator<<(unsigned short n)
{
_WINSTATIC char obuffer[8];
_WINSTATIC char fmt[4] = "%hu";
_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;

}


  3 Responses to “Category : C++ Source Code
Archive   : VCCRT1.ZIP
Filename : OSTRUSHT.CXX

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/