main.cpp
来自「一个用C++编写的文件压缩解压缩程序,实现文本的动态压缩和解压,支持RAR.」· C++ 代码 · 共 45 行
CPP
45 行
//
//-----------------------------------------------------
#include <iostream.h>
#include "czip.h"
//-----------------------------------------------------
//主程序
int main (void)
{
int c;
char source[ MAX_PATH ], target[ MAX_PATH ];
//输入原文件名
cout<< "Input The source file : ";
cin>>source;
//输入目标文件名
cout<< "Input the target file : ";
cin>>target;
//选择工作方式
cout<<"zip(1) / unzip(2) ? ";
cin>>c;
if (c!=1 && c!=2) c=1;
//开始处理文件
try
{
if (c==1)
{
CZip oZip( source );
oZip.SwapSize( target );
}
else
{
CUnzip oUnzip( source );
oUnzip.SwapSize( target );
}
}
//捕获异常
catch( CZipException e )
{
cout<<"problem : "<<e.GetString();
return -1;
}
cout<<"operation ok\n";
return 0;
}
//程序结束
//--------------------------------------------------
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?