Use the following Macros
__FILE__ Source file name (string constant) format "patx.c"
__LINE__ Current source line number (integer)
__DATE__ Date compiled (string constant)format "Dec 14 1985"
__TIME__ Time compiled (string constant) format "15:24:26"
__TIMESTAMP__ Compile date/time (string constant)format "Tue Nov 19 11:39:12 1997"
Usage example
static char stamp[] = "***\nmodule " __FILE__ "\ncompiled " __TIMESTAMP__ "\n***";
...
int main()
{
...
if ( (fp = fopen(fl,"r")) == NULL )
{
printf( "open failed, line %d\n%s\n",__LINE__, stamp );
exit( 4 );
}
...
}
And the output is something like
*** open failed, line 67
******
module myfile.c
compiled Mon Jan 15 11:15:56 1999
***
Monday, July 9, 2007
Subscribe to:
Post Comments (Atom)
5 comments:
Additionally, there is __FUNCTION__ for function name.
Yes! Finally someone writes about compiled.
Take a look at my page; registry cleaner
A wise man can learn more from a foolish question than a fool can learn from a wise answer. See the link below for more info.
#answer
www.mocsbar.com
Hi, yup this post is truly fastidious and I have learned lot of things from it about blogging. thanks.
A motivating discussion is definitely worth comment. I believe that you need to write more about this subject matter, it might not be a taboo subject but typically folks don't speak about these subjects. To the next! All the best!!
Post a Comment