newbieKing
Programmer
Hi!
I can't figure out how to save the current OS date into the name of the output file. For example, if i run the program now, i want the output to be printed into a file called something like "Statistics_April4.txt".
This is what i've tried, but i keep on getting errors.
Please help!
#include <math.h>
#include <conio.h>
#include <iomanip>
#include <fstream>
#include <iostream>
#include <string>
#include <stdio.h>
#include <vector>
#include <stdlib.h>
#include <assert.h>
#include <time.h>
using namespace std;
void main()
{
FILE *fopen(), *fp;
char tmpbuf[128];
string date = _strdate( tmpbuf );
string name = "Statistics";
string filename = name + date;
fp = fopen( filename, "w"
// i've also tried:
//ofstream fout(filename);
//fout << "hahah" << endl;
}
I can't figure out how to save the current OS date into the name of the output file. For example, if i run the program now, i want the output to be printed into a file called something like "Statistics_April4.txt".
This is what i've tried, but i keep on getting errors.
Please help!
#include <math.h>
#include <conio.h>
#include <iomanip>
#include <fstream>
#include <iostream>
#include <string>
#include <stdio.h>
#include <vector>
#include <stdlib.h>
#include <assert.h>
#include <time.h>
using namespace std;
void main()
{
FILE *fopen(), *fp;
char tmpbuf[128];
string date = _strdate( tmpbuf );
string name = "Statistics";
string filename = name + date;
fp = fopen( filename, "w"
// i've also tried:
//ofstream fout(filename);
//fout << "hahah" << endl;
}