📄 rtftest.cpp
字号:
// RtfTest.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "RtfTest.h"
#include "RtfDecoder.h"
#include <windows.h>
#include <Mmsystem.h>
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// The one and only application object
CWinApp theApp;
using namespace std;
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
int nRetCode = 0;
// initialize MFC and print and error on failure
if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
{
// TODO: change error code to suit your needs
_tprintf(_T("Fatal Error: MFC initialization failed\n"));
nRetCode = 1;
}
else
{
// TODO: code your application's behavior here.
CPublicResource *pub;
pub=new CPublicResource;
int outlen,type,charlen;
DWORD t1, t2;
char time[100]={0};
CRtfDecoder rtf(NULL);
u_char *pch=new u_char[MIDBUFSIZE];
FILE *fp=fopen("G:\\lib\\test.rtf","rb");
if(!fp)return 0;
int len=fread(pch,1,MIDBUFSIZE,fp);
fclose(fp);
t1 = timeGetTime();
rtf.decode(pch,len,NULL,0);
t2 = timeGetTime();
sprintf(time,"Lasting Time: %ums\n\n",t2-t1);
charlen=strlen(time);
delete pch;
u_char * out=rtf.get_result(outlen,type);
FILE *fout=fopen("G:\\lib\\test.txt","wb");
fwrite(time,1,charlen,fout);
fwrite(out,1,outlen,fout);
fclose(fout);
}
return nRetCode;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -