This is the mail archive of the libstdc++@sourceware.cygnus.com mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

ostringstream::setfill() problem with cvs tree version


Hi !

I am using the latest libstdc++ cvs tree under RH6.0 and
have encountered a problem with the following code:

#include <iostream>
#include <iomanip>
#include <sstream>
#include <string>
using namespace std;

int main(void) {
  string val = "";
  ostringstream tmp;
  tmp << setw(5) << left << setfill('0') << val;

  cout << "result : <" << tmp.str() << ">" << endl;
  return 0;
}

It generates the following output: "result: <>"

Under MSVC6 i get the expected result <00000>.

If I change the line string val = "" to int val = 1
setfill()/setw() are working  and I get the result <10000>.

Is this a bug or are these manipulators not guranteed to work
with nonnumeric variables?

Any hints are welcome to resolve this problem.

TIA, Bruno
--
Bruno.Voigt@ic3s.de  # IC3S AG # Tel. 04106.653815 # Fax. 04106.4618
____________________ # Mobile 0700.686.00.686


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]