四个常用宏

四个常用宏:

__FILE__// 当前文件名

__DATE__// 编译日期

__LINE__// 编译行数

__TIME__// 编译时间

 

// [email protected]

#include <stdio.h>



int main(void)

{           

    printf("hello, gcc!\n");

    printf("%s\n", __FILE__);  

    printf("%s\n", __DATE__);

    printf("%d\n", __LINE__);

    printf("%s\n", __TIME__);

    return 0; 

}

// vim: set tabstop=4 shiftwidth=4 expandtab:

[hayuk@localhost qinghua]$ ./hello
hello, gcc!
hello.c
Nov  2 2012
9
07:56:26

你可能感兴趣的:(常用)