Persistent ios::setw()

M

Martin Magnusson

Sending setw() to an ostream (for formatting numerical output etc.) only
affects the next field. Is there no way to set width and padding more
permanently?

Thanks,
martin
 
M

Mike Wahler

Martin Magnusson said:
Sending setw() to an ostream (for formatting numerical output etc.) only
affects the next field. Is there no way to set width and padding more
permanently?

'width(0)' is called automatically after insertions.
The fill character remains the same until explicitly
changed.

-Mike
 
F

Fraser Ross

Write an overloaded operator for insertion. I am not sure what happens for
built-in types since there is already overloaded functions for them. It is
a tricky function to write. Normally it returns a reference to the stream
and it is a friend.

Fraser.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
474,145
Messages
2,570,824
Members
47,369
Latest member
FTMZ

Latest Threads

Top