__FILE__ current file nume.
__FUNCTION__ current functionnume.
__LINE__ current line number.
__DATE__ built date.
__TIME__ built time.
================================================
#include
#include
void call_test_fun(void);
#define DBG_PRINT(msg, arg...) printf("%s:%s(%d): " msg, __FILE__, __FUNCTION__, __LINE__, ##arg)
int main(void)
{
printf( "The file is: %s\n", __FILE__ );
printf( "This function is: %s\n", __FUNCTION__ );
printf( "This is line: %d\n", __LINE__ );
printf( "The date is: %s\n", __DATE__ );
printf( "The time is: %s\n", __TIME__ );
call_test_fun();
return 0;
}
void call_test_fun(void)
{
printf( "This function is: %s\n", __func__ );
printf( "The file is: %s\n", __FILE__ );
printf( "This is line: %d\n", __LINE__ );
printf( "STDC: %d \n", __STDC__);
printf( "STDC_HOSTED: %d \n", __STDC_HOSTED__);
printf( "VERSION: %s \n", __VERSION__);
printf( "TIMESTAMP: %s \n", __TIMESTAMP__);
DBG_PRINT("number = %d, str = %s\n", index, str);
}
I will try to do my best. Thanks for your encouragement!
回覆刪除