分类: C/C++
2008-04-20 17:37:34
#include <stdio.h>
#include <time.h>
#include <memory.h>
#include <string.h>
#include <unistd.h>
int main(void)
{
time_t t_time;
char *a_time;
char *day;
char *hour;
day=(char*)malloc(15);
hour=(char*)malloc(15);
printf ("\033[2J");
if ( fork () )
exit(0);
while (1)
{
printf("\33[s");
time (&t_time);
a_time=asctime(localtime(&t_time));
bzero(day,15);
bzero(hour,15);
memcpy(day, a_time, 10);
memcpy(hour, a_time+10, 10);
printf("\033[1;45H\033[K +-----------------------+");
printf("\033[2;45H\033[K + net_robber tell you: +");
printf("\033[3;45H\033[K + %s +",day);
printf("\033[4;45H\033[K + %s +",hour);
printf("\033[5;45H\033[K +-----------------------+");
printf("\33[u");
fflush(stdout);
sleep(1);
}
}