__FILE__和__FUNCTION__的使用

来源:互联网 发布:西门子伺服选型软件 编辑:程序博客网 时间:2024/05/03 20:00

2014年3月22日16:59:19

__FILE__和__FUNCTION__的使用

1、使用VS2008创建一个带预编译头的控制台项目。

2、源文件内容:

#include "stdafx.h"  #include<iostream>  using namespace std;class CEntry{int m_a;public:void test(){char strLog[400]={0};sprintf(strLog,"文件 函数 :%s,%s",__FILE__,__FUNCTION__);printf("%s",strLog);}};int main( void )  {  CEntry aEntry;aEntry.test();char ch;cin>>ch;return 0;  }  


0 0
原创粉丝点击