Thread: quick question: append using an ofstream?

  1. #1
    Registered User
    Join Date
    Feb 2003
    Posts
    265

    quick question: append using an ofstream?

    ofstream myfile;
    myfile.open("file.txt");
    myfile << "bleh";

    this overwrites the file, how do i go about appending to the file?

  2. #2
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    myFile.open( "file.txt", ios::out | ios::app );

    [Edit]
    Stupid ..........ing smilies.
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  3. #3
    Registered User
    Join Date
    Feb 2003
    Posts
    265
    'ios' : is not a class or namespace name

    what header am i missing today.

  4. #4
    Registered User
    Join Date
    Feb 2003
    Posts
    265
    nevermind im a tard.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. quick question (adding characters)
    By Cactus in forum C Programming
    Replies: 2
    Last Post: 09-24-2005, 03:54 PM
  2. very quick question.
    By Unregistered in forum C++ Programming
    Replies: 7
    Last Post: 07-24-2002, 03:48 AM
  3. quick question
    By Unregistered in forum C++ Programming
    Replies: 5
    Last Post: 07-22-2002, 04:44 AM
  4. Quick Question Regarding Pointers
    By charash in forum C++ Programming
    Replies: 4
    Last Post: 05-04-2002, 11:04 AM
  5. Quick question: exit();
    By Cheeze-It in forum C Programming
    Replies: 6
    Last Post: 08-15-2001, 05:46 PM