四个常用宏:

__FILE__// 当前文件名

__DATE__// 编译日期

__LINE__// 编译行数

__TIME__// 编译时间

 

// liangxiaxu@126.com
#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

相关文章:

  • 2022-01-06
  • 2021-12-24
  • 2021-08-27
  • 2021-06-16
  • 2021-08-06
  • 2021-10-22
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-07-09
  • 2021-08-03
  • 2022-01-28
  • 2022-12-23
  • 2022-12-23
  • 2021-08-07
  • 2021-11-21
相关资源
相似解决方案