How make a program (function), which read text file and put a message on screen when date and time are equal of system date,time.
In text file are informations: date, time and a message.
Example text file:
06/03/08
11:30:00
Prepare lunch!
When put the message should be a message box.
ex.program, but not compare with date and time....
Edit/Delete MessageCode:#include <windows.h>
#include <cstdlib>
#include <iostream>
#include <time.h>
#include <fstream>
#include <string>
using namespace std;
int main()
{
char date [9];
char time [9];
char time_dat [9];
char date_dat [9];
//cout << "Date : " << _strdate(date) <<endl;
//cout << "Time : " << _strtime(time) <<endl;
string line;
ifstream myfile ("Scheduler.txt");
if (myfile.is_open())
{
while (!myfile.eof())
{
getline (myfile,line);
cout << line << endl;
}
myfile.close();
}
else cout << "Unable to open file";
/*do
{
if ( !strcmp(time_dat,time) && !strcmp(date_dat,date) )
//read message in text file and put (not time)
if(MessageBox(NULL, time, "Message", MB_ICONINFORMATION) ==IDOK)
exit(0);
}
while(time1 != _strdate(time) && date1 != _strdate(date));*/
return 0;
}