goon12
12-12-2002, 04:03 PM
I have been reading all kinds of man pages, and searching on google.. I am just looking to show the current date / time using C. Could someone let me know the simplest way?
Thanks,
goon12
PS The only way I can get it working is with this UGLY hack:
void tagdate( void )
{
FILE *out;
char now[20];
memset(&now, 0, sizeof(now));
system("date > .dt");
out=fopen(".dt", "r");
fgets(now, sizeof(now), out);
now[strlen(now) - 1] = 0;
printf("date: %s\n", now);
}
Thanks,
goon12
PS The only way I can get it working is with this UGLY hack:
void tagdate( void )
{
FILE *out;
char now[20];
memset(&now, 0, sizeof(now));
system("date > .dt");
out=fopen(".dt", "r");
fgets(now, sizeof(now), out);
now[strlen(now) - 1] = 0;
printf("date: %s\n", now);
}