About appending to a file

This is a discussion on About appending to a file within the C++ Programming forums, part of the General Programming Boards category; Hi all I have a different problem now -- trying to use "ios::app". I understand it is what you use ...

  1. #1
    Registered User
    Join Date
    Apr 2012
    Location
    Florida, Dade County, Homestrad, 33031
    Posts
    40

    About appending to a file

    Hi all
    I have a different problem now -- trying to use "ios::app".

    I understand it is what you use to append to a file, but where is it placed?

    in
    Code:
     ifstream a_file ios::app?
    in
    Code:
     ofstream b_file ios::app?
    in both?.... where?

  2. #2
    ZuK
    ZuK is offline
    Registered User
    Join Date
    Aug 2005
    Location
    Austria
    Posts
    1,990
    Appendig to a stream that you want to read doesn't make sense. does it ?

    Kurt

  3. #3
    Registered User
    Join Date
    May 2010
    Posts
    2,778
    You use the open mode flags when you open the file, or with the non-empty constructor.
    Code:
    ofstream out1;
    out1.open("YourFileName", std::ios::app);
    ofstream out2("YourFileName", std::ios::app);

    Jim

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. File appending
    By rtram in forum C Programming
    Replies: 2
    Last Post: 12-04-2009, 12:06 PM
  2. Appending mid file
    By valaris in forum C Programming
    Replies: 4
    Last Post: 09-05-2008, 08:54 PM
  3. appending to a file
    By kippwinger in forum C++ Programming
    Replies: 9
    Last Post: 03-25-2004, 11:33 AM
  4. Appending to a File
    By mightymouse in forum C Programming
    Replies: 1
    Last Post: 03-15-2004, 04:00 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21