C++ program
I need a program which run as service (in the background).
The program read a txt file where are informations: date/time and message.
example txt file:
2008/06/13
20:00:00
Go to cinema
The program check if time (date/time) is equal of system time (date/time).
If is equal, the program put a message on screen)- ex. Go to cinema.
ex.code , not compare system time and date... how make this?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
VOID ProcMonitorThread(VOID *)
{
while(ProcessStarted == TRUE)
{
//WriteLog(pLogFile, "Write service!!!");
FILE *f;
int tmp;
char c,time[10],date[10],msg[100];
for(tmp=0;tmp<10;++tmp)
time[tmp]='\0';
for(tmp=0;tmp<10;++tmp)
date[tmp]='\0';
for(tmp=0;tmp<10;++tmp)
msg[tmp]='\0';
tmp=0;
f=fopen("Scheduler.txt","r");
while(1)
{
c=getc(f);
if(c==' ')break;
time[tmp]=c;
++tmp;
}
tmp=0;
while(1)
{
c=getc(f);
if(c==' ')break;
date[tmp]=c;
++tmp;
}
tmp=0;
while(1)
{
c=getc(f);
if(c==EOF)break;
msg[tmp]=c;
++tmp;
}
fclose(f);
MessageBox(NULL,("Time: %s Date: %s Message: %s",time,date,msg),"Message window",0);
}
}
| |
Topic archived. No new replies allowed.