Scanning Documents (C++)
This function scans “n” images and creates a set with the scanned images.
SETOFIMG *ScanNImage(int num)
{
int i;
SETOFIMG *set; // create an empty set
set=CreateMultipleImg(); // check for error
if (set==NULL) return NULL; // Initialize scanning session
if (ScanInit()) return NULL;
for(i=0;i<n;i++)
{
// scan a new image, add it to set and check for error
if (ScanAndAddImage(set))
{
// An error occured
FreeMultipleImg(set);
ScanEnd();
return NULL;
}
}
// Terminate scanning session
ScanEnd();
// return the set
return set;
}