#include "stdio.h"
#include "string.h"
#include "windows.h"
void Test(void)
{
char *cp_str = NULL;
cp_str = new char[100];
strcpy(cp_str,"Hello,world!");
printf(cp_str);
return;
}
void main()
{
Test();
int a[3] = {1,2,3};
int *p, *q;
p=a;
q=&a[2];
int b = a[q-a];
printf("\na[q-a] = %d\n",b);
printf("当前文件名:%s\n",__FILE__);//输出当前程序文件名
printf("当前行号:%ld\n",__LINE__);//输出源文件的当前行号
//printf("当前日期:%d%d%d\n",__DATE__ );//
//printf("当前编译编译的是C++还是C程序:%s\n",__STDC__ );
#ifdef __cplusplus
printf("当前编译的是C++程序\n");
#else
printf("当前编译的是C程序");
#endif
printf("当前时间%s\n",__TIME__ );
system("pause");
}
VS2005编译器自定义宏__FILE__,__LINE__,__TIME__
最新推荐文章于 2024-07-02 17:27:54 发布