writing new line at end of file

This is a discussion on writing new line at end of file within the C++ Programming forums, part of the General Programming Boards category; Hey all, How does one append a new line to an existing text file? The text file is basically a ...

  1. #1
    Registered User deleeuw's Avatar
    Join Date
    Aug 2001
    Posts
    31

    writing new line at end of file

    Hey all,
    How does one append a new line to an existing text file?
    The text file is basically a list
    that gets items added to it on a regaular basis
    Deum solum fidentia est

  2. #2
    Registered User
    Join Date
    Sep 2002
    Posts
    254
    ios::app

  3. #3
    Registered User
    Join Date
    Oct 2002
    Posts
    291
    Code:
    ofstream file("somefile.txt", ios::app);
    file << "Hello world";
    file.close();

  4. #4
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

  5. #5
    Registered User deleeuw's Avatar
    Join Date
    Aug 2001
    Posts
    31
    BTW--Thanks for the code:
    the ios::app worked!
    Deum solum fidentia est

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Data Structure Eror
    By prominababy in forum C Programming
    Replies: 3
    Last Post: 01-06-2009, 08:35 AM
  2. Replies: 8
    Last Post: 12-06-2008, 01:43 PM
  3. Can we have vector of vector?
    By ketu1 in forum C++ Programming
    Replies: 24
    Last Post: 01-03-2008, 04:02 AM
  4. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  5. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 09:54 AM

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