GCC预先定义的宏: __FILE__, __func__, __LINE__, etc

测试代码:
//testout.c
#include <stdio.h>
void main()
{
printf("cur file : %s ; cur func : %s ; cur line : %d, gcc version: %s, base file: %s, date: %s, time: %s\n", __FILE__, __func__, __LINE__, __VERSION__, __BASE_FILE__, __DATE__, __TIME__);
return;
}


编译: gcc -o testout testout.c


运行:
./testout
cur file : testout.c ; cur func : main ; cur line : 6, gcc version: 4.5.2, base file: testout.c, date: Oct 31 2012, time: 10:42:03

你可能感兴趣的:(File)