Thursday, November 25, 2010

IOS Flags

When writing to a stream, setting the justification property (e.g., right and left) continues until it is changed.

If you are writing a logger, it is programmatically polite to first save the ios flags with a statement like:
    ios::fmtflags flags = cout.flag(); // Save the flags.
    // Change cout flags the way you want.
    cout.flags(flags); // Restore the flags.

No comments:

Post a Comment