您的位置:首页 > 其它

printf的另类用法

2012-11-13 15:16 246 查看
真的没想到它竟然可以这么用

// important.cpp : Defines the entry point for the console application.
//

/************************************************************************/
/*  使用方法:在CMD命令处理行进入debug目录下,
/*  执行Important.exe > ***.h 在同目录下生成***.h头文件
/************************************************************************/

#include "stdafx.h"
#include <Windows.h>
#include <iostream>
using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
printf("English:{\n");
for (int index = 0; index < 1000; ++index)
{
printf("    0x%04x ===== %04d\n", index, index);
}
printf("}End\n");
return 0;
}


注意使用上面的“>”符号,否则导出相应的.h文件,该文件内容是printf函数导出的

具体步骤:

1.创建一个工程,编译上述代码===如Important.exe

2.输入Cmd进入控制台程序

3.进入相应的盘符,否则导出的文件找不到

4.将编译exe拖入控制台中,后加入“>123.h”,同级目录下看到该文件

5.查看文件
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: