Jump to content
  • Advertisement
Sign in to follow this  
Jonus

is there a easy way to reset all flags of ios?

This topic is 4845 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Like to change back the fill('*') to a whitespace and change the width(10) back to default? I simply want to reset the whole thing.

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by deadimp
Here's a link on C++ I/O.
My money is on the function "unsetf()".
yep, i know this function, but with it i have to use it for every single flag i want to clear. Well ok.

Share this post


Link to post
Share on other sites
You could use copyfmt() with a fresh stream object, but that's probably overkill.

Or you might use boost's IO state saver to save and then restore the stream state.

Share this post


Link to post
Share on other sites
Quote:
Original post by Jonus
I simply want to reset the whole thing.


I assume you mean format flags and not stream state flags you could do:


std::ios_base::fmtflags original_flags = my_stream.flags();

// ... set format flags ...

my_stream.flags(original_flags); // reset them back to default.



Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!