Could some body in this forum advise me with a simple code on how to diplay DATE and TIME using printf() statement. I tried cut and paste the one posted here, and it did not even compile ... whole bunch of syntax errors !!!! Thanks in advance, JIMMY
If you are just trying to print out the date and time of compilation all you need is: printf("%s %s",__DATE__,__TIME__); Stefan
OR even just:
printf( __DATE__ __TIME__ );
What I do is just have a single file - eg, timestamp.c - in the project which just defines a string containing the date & Time:
char timestamp[] = __DATE__ __TIME__;
"and you don't need a format string if you're just printing a string literal" Might as well dump the printf() as well and just use puts(). Stefan