📄 comptest.cpp
字号:
// comptest.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "comptest.h"
#include "flate.h"
#include "ByteArrayStream.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// The one and only application object
CWinApp theApp;
using namespace std;
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
CByteArray ba;
{
CFile file;
VERIFY ( file.Open(_T("flate.cpp"), CFile::modeRead) != FALSE );
ba.SetSize(file.GetLength());
file.Read(ba.GetData(), ba.GetSize());
}
CByteArray comp;
CByteArray uncomp;
Flate compressor;
{
CBAStreamReader sr(ba.GetData(), ba.GetSize());
CBAStreamWriter sw(comp);
compressor.Deflate(&sw, &sr);
}
VERIFY( ba.GetSize() > comp.GetSize() );
{
CBAStreamReader sr(comp.GetData(), comp.GetSize());
CBAStreamWriter sw(uncomp);
compressor.Inflate(&sw, &sr);
}
VERIFY( uncomp.GetSize() > comp.GetSize() );
VERIFY( memcmp(ba.GetData(), uncomp.GetData(), uncomp.GetSize()) == 0 );
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -