delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/08/31/22:30:11

From: brk AT mail DOT eclipse DOT net (Brian Kennedy)
Subject: Re: <ios> and std::right?
Newsgroups: comp.os.msdos.djgpp
References: <20010831220708 DOT 29894 DOT qmail AT web10004 DOT mail DOT yahoo DOT com>
X-Newsreader: TIN [version 1.2 PL2]
Lines: 41
Message-ID: <1DXj7.190$tc5.58905722@news.netcarrier.net>
Date: Sat, 01 Sep 2001 02:21:49 GMT
NNTP-Posting-Host: 207.207.192.13
X-Complaints-To: news AT netcarrier DOT com
X-Trace: news.netcarrier.net 999310909 207.207.192.13 (Fri, 31 Aug 2001 22:21:49 EDT)
NNTP-Posting-Date: Fri, 31 Aug 2001 22:21:49 EDT
Organization: NetCarrier Internet Services
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

In message <20010831220708 DOT 29894 DOT qmail AT web10004 DOT mail DOT yahoo DOT com>, chris
smith (c_smith_1 AT yahoo DOT com) wrote:

:Use ios::right, not std::right.

I didn't think ios::right was the same thing (?).

For example, neither of these two programs (from
http://www.cuj.com/experts/1902/austern.htm?topic=experts) will compile
for me.  Shouldn't they work with DJGPP?

///////////////
//
// Program one
//
///////////////
#include <iostream>
int main() {
  std::cout.setf(std::ios_base::hex,
                 std::ios_base::basefield);
  std::cout.setf(std::ios::right, 
                 std::ios_base::adjustfield);
  std::cout.width(10);
  std::cout << 42 << std::endl;
}

///////////////
//
// Program two
//
///////////////
#include <iostream>
#include <iomanip>
int main() {
  std::cout << std::hex << std::right << std::setw(10);
  std::cout << 42 << std::endl;
}

--------------------------------------------------------------
Brian Kennedy
brk AT eclipse DOT net 

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019