Adding to a file

This is a discussion on Adding to a file within the C++ Programming forums, part of the General Programming Boards category; Hey, i need some help. i am currently writing to a file (using outfile) but i want to know whether ...

Not sure I quite understand. If you have a file, you can read from it, and then write to it later, if you want. If you want to add on to the end of the file, you can use the ios_base::app flag when opening it:

Files can come from anywhere. You can write them yourself using a text editor. They may contain data written from another program. They may contain data written from the current program. But whereever the data came from, if it is in the correct format, you can load it into your program where you can use the data in some fashion. You can then leave the data in the file unchanged, or change the data stored in the file by writing data from your program back to the file.

While the data is in your program it is held in a container of some sort. Containers can range in complexity from a primitive variable like an int, char or array or more complicated like a list or an instance of a user defined class or an instance of even be a more sophisticated container like a queue or a multimap or whatever.

The data held in the containers within your program doesn't have to come from files, either. It could be hard coded, input by a user, or be derived from a function within the current or other active program. However you obtain data for the containers in your program, what you do with the data within your program and how you handle the data after the after you are done with it is up to you.