Wrting to the END of a text file

This is a discussion on Wrting to the END of a text file within the C++ Programming forums, part of the General Programming Boards category; How do you make it so you write to the end of a file, instead of writing over the file?...

  1. #1
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052

    Wrting to the END of a text file

    How do you make it so you write to the end of a file, instead of writing over the file?
    Please direct all complaints regarding this post to the nearest brick wall Have a nice day.

  2. #2
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052
    anybody...?
    Please direct all complaints regarding this post to the nearest brick wall Have a nice day.

  3. #3
    Registered User
    Join Date
    Oct 2001
    Posts
    23
    I suggest you show us a piece of you code that wirtes over the file, and we'll correct it to appending to the file...

  4. #4
    Registered User
    Join Date
    Aug 2001
    Posts
    72
    Hi,
    when you use

    Code:
    void open(const char *s,
        ios_base::openmode mode = ios_base::out | ios_base::trunc);
    check the predefined constants in ios_base class:

    Code:
        static const openmode app, ate, binary, in, out, trunc;
    and provide ios_base :: app instead of ios_base::trunc

    e.g.

    Code:
         output.open("data.txt", ios_base::out | ios_base::app);

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Newbie homework help
    By fossage in forum C Programming
    Replies: 3
    Last Post: 04-30-2009, 04:27 PM
  2. File transfer- the file sometimes not full transferred
    By shu_fei86 in forum C# Programming
    Replies: 13
    Last Post: 03-13-2009, 12:44 PM
  3. Formatting a text file...
    By dagorsul in forum C Programming
    Replies: 12
    Last Post: 05-02-2008, 03:53 AM
  4. Basic text file encoder
    By Abda92 in forum C Programming
    Replies: 15
    Last Post: 05-22-2007, 01:19 PM
  5. Ok, Structs, I need help I am not familiar with them
    By incognito in forum C++ Programming
    Replies: 7
    Last Post: 06-29-2002, 09:45 PM

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