The first gives you a number holding the time, the second gives you a formatted string like printf holding the information that you want (day of the week, hour, etc)
if you want to know more, ask me.
--Azdo--
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
How can I print the actual time in my Dos-program?
You can use the <time.h> functions:
time_t time(time_t *tp);
size_t strftime(char *s, size_t smax, const chat *fmt, const struct tm *tp);
The first gives you a number holding the time, the second gives you a formatted string like printf holding the information that you want (day of the week, hour, etc)
if you want to know more, ask me.
--Azdo--
Hi, I'm also looking into doing this. Anyone kind enough to share a sample code? Thx in advance.
Try this:
#include <stdio.h>
#include <time.h>
int main()
{ time_t actual;
struct tm *loctime;
char string[60];
actual = time(NULL);
loctime = localtime (&actual);
strftime(string , 60, "The current time is %H:%M:%S",loctime);
printf("%s\n",string);
}
It prints the actual time :-)
For more on this see www.cppreference.com
Bye