delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/04/12/18:23:28

From: Jason Green <news AT jgreen4 DOT fsnet DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: left adjustment with iomanip
Date: Wed, 12 Apr 2000 22:36:53 +0100
Organization: Customer of Planet Online
Lines: 34
Message-ID: <dhq9fsch3sji7tq29r0ekbna6fj7jhtfl1@4ax.com>
References: <8cvctg$nj1$1 AT news DOT lth DOT se> <gUn0OKR93hpcV2vSqBLHrpSnNZoY AT 4ax DOT com>
NNTP-Posting-Host: modem-88.endostatin.dialup.pol.co.uk
Mime-Version: 1.0
X-Trace: newsg4.svr.pol.co.uk 955576141 11277 62.136.92.216 (12 Apr 2000 21:49:01 GMT)
NNTP-Posting-Date: 12 Apr 2000 21:49:01 GMT
X-Complaints-To: abuse AT theplanet DOT net
X-Newsreader: Forte Agent 1.7/32.534
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Bojan Resnik <resnikb AT eunet DOT yu> wrote:

>    There is no 'left' manipulator, but there is one which allows you to set
> the flags of the stream. It's 'setiosflags':
> 
>    cout << setiosflags(ios::left) << setw(50) << "Hello world";

There is a left manipulator defined in the standard, but it is not yet
implemented in GCC.

As a workaround, it is possible to define your own version:

/* ------------------------------------------------ */
#include <iostream>
#include <iomanip>
using namespace std;

ios& left(ios& i)
{ i.setf(ios::left, ios::adjustfield); return i; }

int main()
{
    cout << left << setw(50) << "Hello world";
}
/* ------------------------------------------------ */

Missing features of <iomanip> have been reported here before.  But
DJGPP does not provide the C++ implementation so these problems should
be reported to the relevant GCC group.

Given the fundamental nature of the problems, (and the apparently easy
fix), it is probably already being worked on.  If you ask in a GCC
group you might get some some idea of when these features will be
implemented.

- Raw text -


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