How to setiosflag ios::app/ios::out

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tarcisio
    New Member
    • May 2015
    • 2

    #1

    How to setiosflag ios::app/ios::out

    In a program I want to chang the behavior of ofstream so that I can either append or rewrite a file. What is the type of the flags ios::app, ios::out so I can use a variable to switch between under the flow of the program?
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    Those are the std::ios_base:: openmode flags:

    ios::app
    ios::ate
    ios::binary
    ios::in
    ios::out
    ios::trunc

    Since ofstream derives from ios_base, you can use the public member openmode with these values provided they are supported by ofstream.

    Comment

    Working...