LIBDF: df-file applying (reconstruction of a new file)

Now let's take up the sequence of actions needed to successfully restore a new file having an old file and a difference file (df-file).

 

The easiest way to apply df-file is to use the following function:

 

int dfApply ( _TCHAR const * szDfFile, _TCHAR const * szOldFileName, _TCHAR const * szNewFileName );

 

You need to set names of those 3 files that participate in df-file applying, and namely: name of df-file, name of an old file and name of a new file. And that's all.

 

However to get extended features on df-file applying you need to use other functions.

 

int dfOpenDfFile ( _TCHAR const * szDfFile, TDfHandle * phDf );

 

This function opens df-file which name is set by szDfFile parameter and performs verification of its integrity. In case of successful call of dfOpenDfFile the value of the variable of type TDfHandle on which phDf points will be used as a special descriptor of the successfully opened df-file. Pay attention that this descriptor is valid only within LIBDF functions context and have nothing to do with common file descriptors, created for instance by system function CreateFile.

 

TDfCmp const * dfGetDfInfo ( TDfHandle hDf );

 

Using this function you can extract information from df-file about compared files which is identical to that represented by the comparing context at the moment of dfBuildN (or dfBuildH) calling.

 

Restoring of a new file is implemented using one of the following functions: dfApplyN or dfApplyH.

Difference between these functions lies in the method of specifying files which participate in the operation: names of files or already created common files descriptors and also in the additional parameter of df-file applying.

 

int dfApplyN ( TDfHandle hDf, _TCHAR const * szOldFileName, _TCHAR const * szNewFileName, int iApplyFlags, TDfInteract * pInteract );

 

int dfApplyH ( TDfHandle hDf, FD_T hOldFile, FD_T hNewFile, int iApplyFlags, TDfInteract * pInteract );

 

It is significant to note that iApplyFlags parameter can be used to cancel updating of any file component.

(See dfApplyN, dfApplyH functions descriptions for details)

 

Converted from CHM to HTML with chm2web Standard 2.75 (unicode)