顺便提一下,两个很有用的系统宏,一个是"__FILE__",一个是"__LINE__",分别表示,所在的源文件和行号,当你调试信息或是输出错误时,可以使用这两个宏,让你一眼就能看出你的错误,出现在哪个文件的第几行中。这对于用C/C++做的大工程非常的管用。
// file_line.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
int main(int argc, char* argv[])
{
printf(__FILE__);printf("\n");
printf("%d",__LINE__);printf("\n");
printf(__DATE__);printf("\n");
printf(__TIME__);printf("\n");
return 0;
}
/*
D:\My Documents\vc6_Projects\file_line\file_line.cpp
9
May 21 2013
14:05:43
Press any key to continue
*/
"****** 建立日期:",__DATE__," ******\r\n",
"****** 建立时间:",__TIME__," ******\r\n",