Simple Append Query

This is a discussion on Simple Append Query within the C++ Programming forums, part of the General Programming Boards category; hi i was wondering how i could append on to a particular line in a txt file from my program ...

  1. #1
    James23
    Guest

    Simple Append Query

    hi i was wondering how i could append on to a particular line in a txt file from my program .Thanx

  2. #2
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    To append to a line in the middle of the file, you need to read the whole file in and rewrite it. You can't "insert" text into a file directly.

    To append to the end of the file, simply open the file in append mode.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  3. #3
    end0
    Guest
    Originally posted by Hammer
    To append to the end of the file, simply open the file in append mode.
    Code:
    ofstream fileOut( "test.txt", ios::app );

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. query problem
    By arian in forum C# Programming
    Replies: 1
    Last Post: 08-18-2008, 02:49 PM
  2. Simple simple program
    By Ryback in forum C++ Programming
    Replies: 10
    Last Post: 09-09-2004, 06:48 AM
  3. Simple string query
    By ozzy34 in forum C++ Programming
    Replies: 3
    Last Post: 05-13-2004, 12:40 PM
  4. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM
  5. Need help with simple DAQ program
    By canada-paul in forum C++ Programming
    Replies: 12
    Last Post: 03-15-2002, 08:52 AM

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