PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.cplus > iomanip setw() and std::string
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
iomanip setw() and std::string

Réponse
 
LinkBack Outils de la discussion
Vieux 07/02/2008, 12h25   #1
[rob desbois]
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut iomanip setw() and std::string

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
  Réponse avec citation
Vieux 08/02/2008, 08h32   #2
James Kanze
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: iomanip setw() and std::string

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
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 17h45.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,07639 seconds with 10 queries