65.9K
CodeProject 正在变化。 阅读更多。
Home

CSplitMX - Visual C++ 的文件拆分类

starIconstarIconstarIconstarIconstarIcon

5.00/5 (1投票)

2002年10月30日

CPOL
viewsIcon

60772

downloadIcon

1229

这个类可以将一个源文件分割成许多较小的部分,这些部分可以分发到网络上或存储在软盘上。

引言

好的,让我们开始吧。CSplitMX 为用 Visual C++ 编写的任何 Windows 应用程序添加文件分割功能。我一直想要一个易于使用的类,允许我将文件分割成较小的部分,但只找到了 VB 源代码或根本没有找到。因此,我决定自己编写这个类。即使源代码没有注释,也相对容易理解,但以下是概述。要使用 CSplitMX,请将两个文件 Split.cppSplit.h 包含在您的项目中,并将 split.h 链接到您希望使用分割功能的类/文件中。

使用代码

CString m_FileName = "My.exe"; // file larger than 720 KB
int cSize = 720000; // 720 KB
CSplitMX MX;
MX.Init(); // this allows the class to reset all its internal attributes
MX.SetFileName(m_FileName); // sets the name of the source file been split
MX.SetSplitSize(cSize); // sets the split size to 720KB
MX.SplitFile(); // this function splits the file

演示项目演示了使用该类的必要方法。

玩得开心。

© . All rights reserved.