Hello. I'm writing DOS program with Visual C++ 6 and i want to log date and time to file. I'm new at programming so please tell me all #include <> and full syntax :) Also I tried time() but i recieved error:
error C2064: term does not evaluate to a function.
Yes you need to include <ctime> as mike_2000_17 told you, and here's some help on using it:
using namespace std;
time_t *rawtime = new time_t; // we'll get the time here by time() function.
struct tm * timeinfo; /* we'll get the time info. (sec, min, hour, etc...) here from rawtime by the localtime() function */
time(rawtime); // Get time into rawtime
timeinfo = localtime(rawtime); // Get time info into timeinfo
cout << "Time now is " << timeinfo->tm_hour << ":" << timeinfo->tm_min << ":" << timeinfo->tm_sec << endl;
cin.get(); // pause
members of struct tm