宏定义 日志输出

来源:互联网 发布:成都景鑫云科技 知乎 编辑:程序博客网 时间:2024/06/11 00:27
  1. #define DEBUG(format,...) printf("File: "__FILE__", Line: %05d: "format"/n", __LINE__, ##__VA_ARGS__)  
  2. #else  
  3. #define DEBUG(format,...)  
  4. #endif  
  5. int main() {  
  6.     char str[]="Hello World";  
  7.     DEBUG("A ha, check me: %s",str);  
  8.     return 0;  

  1. }  
  2. 测试结果:

    是不是感觉很酷?O(∩_∩)O哈哈

    转载来自:http://blog.csdn.net/cp1300/article/details/7773239

0 0
原创粉丝点击