Merging and decomposition of multiple files

Source: Internet
Author: User
Tags bool

This program example how to combine multiple files into a single file and be able to decompose itself. This technique is useful when making setup programs. I learned this technology on this site, and will be able to organize the extension, can merge files and directories, the number of unlimited.

The core program includes a merged file Class Ccombinefiles, a class cextractfiles for decomposing files, and information about a data class FileInfo file or directory information that represents a file or directory is represented by the FileInfo class. This class is defined as follows:class FileInfo 
{
public:
  const FileInfo &operator = (const FileInfo &fi);
  FileInfo(CString szFileName, UINT nFileSize, UINT nPos, char type = 0);
  FileInfo();
  virtual ~FileInfo();
public:
  CString szFileName;
  UINT nSize;
  UINT nPos;
  char type; // d --- directory , f --- file , other --- no define
};

The merged file class Ccombinefiles is defined as follows:

class CCombineFiles
{
public:
  bool Combine(CStringArray &fileList, CString szToFileName);
  CCombineFiles(CString szExeFileName);
  virtual ~CCombineFiles();
public:
  bool WriteFileInfo(FileInfo fi, FILE *fp);
  bool WriteString(CString szStr, FILE *fp);
  bool WriteListInfo(CArray &fiList, FILE *fp, UINT nStartOffset);
  bool CombineFile(CString szFileName, FILE *fp);
  bool CombineDirectory(CString szDir, FILE *fp);
  CString m_szExeFileName;
};

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.