hi, i have a program that saves data to file and i want to put a time stamp of the current date/time on that log but when i try to write the time to the file it will not show up but the other data i write will.
#include <iostream>
#include <windows.h>
#include <fstream>
#include <string>
#include <sstream>
#include <direct.h>
#include <stdio.h>
#include <time.h>
using namespace std;
string header_str = ("NULL");
int main()
{
for(;;)
{
stringstream header(stringstream::in | stringstream::out);
header << "datasdasdasd_";
time_t rawtime;
time ( &rawtime );
header << ctime (&rawtime);
header_str = header.str();
fstream filestr;
filestr.open ("C:\\test.txt", fstream::in | fstream::out | fstream::app | ios_base::binary | ios_base::out);
for(;;)
{
filestr << (header_str);
}
filestr.close();
}
return 0;
}
anyone know how to fix this?