Writing New Files

I am new to this site, but I have come here to browse several times for help on different things. Here is my question:
I am trying to write a program to take down notes for me, a journal sort of thing. My issue at the moment is that I want to be able to write a new note every time, rather than edit the same note. Please bare with me as I am fairly new to all this. I was wondering how I could have the program either check for the existence of a previous file and name the new one a +1 to that or would it be better to just have the file be named as the date? And if so, how would I go about always making the file name the name of the date? Would I be able to swap the name of the file "fout" for example, with a string like "date"? My other (obvious) issue that I am not quite ready to tackle yet is to actually implement date / time into the program. Here is my code. Thanks for any help you can provide.

#include <cstdlib>
#include <iostream>
#include <fstream>

using namespace std;

int main()
{
string userin;
int time;

time = 1;

// Checking
if {


// Greeting User
cout << "Why Hello there again, ARGOS.\n";
cout << "What would you like me to record for you today? (" << time << ")\n";

// Getting input
getline (cin, userin);

// Opening / Creating File
ofstream file;
file.open ("FileWriting.dat");

// Editing File
file << "Well hello there, ARGOS. This was your entry from today (" << time << ")\n\n" << userin << "\n";

// Closing file
file.close();
system("PAUSE");
return 0;
}
As far as I know there are some OS specific commands you could utilize... or you could check out Boost. They have a FileSystem library that could help. http://www.boost.org/doc/libs/1_53_0/libs/filesystem/doc/index.htm
Topic archived. No new replies allowed.