C/C++ 获取代码执行的行数以及文件名

#include <iostream>
#include <string>
using namespace std;

 

void _tmain(int argc, TCHAR *argv[])
{

int line = __LINE__;
string filename = __FILE__;

cout<<"the line is:"<<line<<endl;
cout<<"the filename is :"<<filename<<endl;

system("pause");


}

 

posted @ 2014-07-29 17:26  hxb316  阅读(621)  评论(0编辑  收藏  举报