home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_144 / 8.ddi / IOSTRSR1.ZIP / MNSBASE.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-10  |  1.1 KB  |  43 lines

  1. /*[]------------------------------------------------------------[]*/
  2. /*|                                                              |*/
  3. /*|     mnsbase.cpp                                              |*/
  4. /*|                                                              |*/
  5. /*|     Predefined manipulators                                  |*/
  6. /*|         smanip_int setbase( int )                            |*/
  7. /*|                                                              |*/
  8. /*[]------------------------------------------------------------[]*/
  9.  
  10.  
  11. /*
  12.  *      C/C++ Run Time Library - Version 5.0
  13.  *
  14.  *      Copyright (c) 1990, 1992 by Borland International
  15.  *      All Rights Reserved.
  16.  *
  17.  */
  18.  
  19. #include <ioconfig.h>
  20. #include <iostream.h>
  21. #include <iomanip.h>
  22.  
  23. // set the conversion base to 0, 8, 10, or 16
  24.  
  25. static ios _FAR & sbase(ios _FAR & i, int b)
  26. {
  27.     long l = 0;
  28.     if( b == 16 )
  29.         l = ios::hex;
  30.     else if (b == 10)
  31.         l = ios::dec;
  32.     else if( b == 8 )
  33.         l = ios::oct;
  34.     i.setf(l, ios::basefield);
  35.     return i;
  36. }
  37.  
  38. smanip_int setbase(int b)
  39. {
  40.     return smanip_int(sbase, b);
  41. }
  42.  
  43.