Applies To
File.
Purpose
Compares two DIO files.
Syntax
DioCompareFiles (szFileName1, szFileName2, pdwStep1, pdwStep2, pdwIn1, pdwIn2, nBoards, pnStatus)
Parameters
Name |
Type |
Comments |
szFileName1 szFileName2 |
STRING |
DIO files to be compared. Both files must be in the DIOEasy 2.0 format. |
pdwStep1 pdwStep2 |
PDWORD |
When calling this function, these parameters contain the (0 based) starting step number for comparing szFileName1 and szFileName2. The function returns step numbers (if any) where contents differ. Negative one (-1) is returned if the end of file is reached and no difference is encountered. |
pdwIn1 pdwIn2 |
PDWORD |
Returns array containing the first step number with difference for the Master and all Slaves. The function fills the array with the failed step from the two files to be compared. Each element contains the step-input value for each board. The size of the array is the number of configured Slaves plus 1 (for the Master). |
nBoards |
SHORT |
The number of elements in either pdwIn1 or pdwIn2 arrays. This number represents the number of boards associated with these files (Master and Slaves). |
pnStatus |
PSHORT |
Returned status: 0 on success, negative number on failure. |
Comments
If the files do not contain the same number of steps, the function returns -1 in the last step of pdwStepX (where X represents the shorter file). Consecutive calls to the function returns the next step values for pdwStepY (where Y is the longer file). The function treats steps without corresponding match step as empty or null not zero.
The function compares only *.DIO files.
Example
The following example prints all differences between the two files. The first file is a DIOEasy2.0 file and the second file is a file created by the DioSaveFile function.
DWORD dwStep1=0, dwStep2=0, dwIn1, dwIn2;
SHORT nStatus;
do{ DioCompareFiles (“a.dio”, “b.di”, &dwStep1, &dwStep2, &dwIn1, &dwIn2, 1, &nStatus);
if (dwStep1 == -1 && dwStep2 == -1) break;
printf (“failed step=%1X, vector1=%1X, vector2=%1X”, dwStep1, dwIn1, dwIn2);
dwStep1++;
dwStep2++;
} while(1);
See Also
DioSaveFile, DioLoadFile, DioGetErrorString