这几个宏是编译器内置的,不是哪个头文件中包含的,所以不需要包含任何头文件。
代码如下:
- #include <stdio.h>
- int main()
- {
- printf("The file is %s.\n",__FILE__);
- printf( "The date is %s.\n", __DATE__ );
- printf( "The time is %s.\n", __TIME__ );
- printf( "This is line %d.\n", __LINE__ );
- printf( "This function is %s.\n", __FUNCTION__ );
- return 0;
- }
- The file is macro.c.
- The date is Aug 24 2012.
- The time is 23:13:26.
- This is line 8.
- This function is main.