65.9K
CodeProject is changing. Read more.
Home

CSplitMX - File Splitting Class for Visual C++

starIconstarIconstarIconstarIconstarIcon

5.00/5 (1 vote)

Oct 30, 2002

CPOL
viewsIcon

60510

downloadIcon

1229

This class splits a source file into many smaller pieces which can be distributed accross the web or on floppy disk.

Introduction

Ok, lets get started. CSplitMX adds file splitting capabilities to any Windows application written in Visual C++. I have always wanted an easy class that allowed me to split files into smaller pieces but only could find either VB sources or none at all. I have then decided to write the class myself. The source is relatively easy to understand even if they are not commented, but anywhere here is the rundown. To use CSplitMX include the two files Split.cpp and Split.h in your project and link split.h to the class/files you want to use the splitting functions in.

Using the code:

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

The demo project demonstrates the necessary approach to the class.

Have fun.