|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hi all,
I've just discovered that when outputting a string in combination with the I/O manipulator setw(n), it doesn't affect the string. Instead the string's c_str() method must be called for setw() to work. I initially thought it was a bug in my implementation, but apparently not. Can anyone inform me why this is? TIA, --rob |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
On Feb 7, 1:25 pm, "[rob desbois]" <rob.desb...@gmail.com> wrote:
> I've just discovered that when outputting a string in combination with > the I/O manipulator setw(n), it doesn't affect the string. Instead the > string's c_str() method must be called for setw() to work. > I initially thought it was a bug in my implementation, but > apparently not. Can anyone inform me why this is? Sounds like a bug to me. The insertion operator on an std::string is required to take the width into account, and always has been. And it works with all of the implementations of the library I have available here (g++, Roguewave and STLport). -- James Kanze (GABI Software) email:james.kanze@gmail.com Conseils en informatique orientée objet/ Beratung in objektorientierter Datenverarbeitung 9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34 |
|
![]() |
| Outils de la discussion | |
|
|