hi i was wondering how i could append on to a particular line in a txt file from my program .Thanx
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 ...
hi i was wondering how i could append on to a particular line in a txt file from my program .Thanx
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]
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 );