I am staring to learn c++ as a hobby, and my current "project" is to document the workload of my
weightlifting sessions. As of now my code (when executed) will ask for various data (body-weight,
exercise type, weight, reps, etc.), it then will create a file and write the various combinations to
it that I want. My code looks like (ignoring the preamble -- #include <iostream>, etc. -- and
cutting the bulk to save space):
1 2 3 4 5 6 7 8 9 10 11
|
int main() {
ofstream outputFile;
outputFile.open("programming.txt");
/* Rest of the code goes here */
outputFile.close();
return 0;
}
|
When I compile and run my program it works great (for now), but it will create a new
"programming.txt" each time (as you'd expect). What I would like is to append to the current txt
file each time. For example, on day 1 I run my program and create the txt file with the data, then
on day 2 I run my program and it adds the new workout session data to the txt file below (or above)
the data for day 1. And so on.
Any help or pointers to relevant references would be great, and thanks in advance.