How do i make my program make new txt files?

I want to make a program that can know the current time and create a new .txt file.For example if its Monday to day then when its Tuesday it crates a new txt file called Tuesday.I really don't know how to go about this.I know i will need to use the time.h library.Any help would be precipitated.
closed account (Dy7SLyTq)
fstream
Lol yes i know how to make .txt files with c++.What i am asking is that how do i make my program make new .txt files at certain in times.For example if the time was 12:00AM then i want my program to make a new .txt called June 2nd.
closed account (N36fSL3A)
ofstream. I think you just open a file and if it isn't there it'll create one for ya.

Output the same way you do with cout. For example...

1
2
3
4
5
std::ofstream mahstream("mahtext.txt");

mahstream << "Your text\n";

mahstream.close;
closed account (Dy7SLyTq)
#include <ctime>

//this is pseudo code not actual code at this point
time_t time = get_time();
if(time == "12:00AM")
make_new_text_file();

of course if ur on linux or mac you can always just cron it
Topic archived. No new replies allowed.