A SERVICE OF

logo

4-16 Programmer’s Manual
/* Calibrate with constant 2" width and paper type */
/* Let function prompt for the stock length */
usStatus = pclCalibrate(0xFFFF, 200, MMS_LOW_ENERGY, 0, 0);
if (usStatus != 0)
{
printf("Calibrate Failed\nError: %u", usStatus);
pclClose();
exit(1);
}
pclClose();
exit(0);
}
/* Calibration callback function to prompt for paper type */
unsigned short far pascal StockTypePrompt
(unsigned short far * lpusPaperType)
{
short sCols, sPages, sKey;
for (;;) // loop doing ...
{ // clear screen
vidSetMode(vidGetState(&sCols, &sPages));
printf("Enter Stock Type\n(0-2):\n"); // display prompt
sKey = _getch(); // get key
if (sKey == 0) // if extended key
_getch(); // clear it out
else if (sKey >= '0' && sKey <= '2') // if valid type
break; // stop prompting
}
*lpusPaperType = (unsigned short) sKey; // save the setting
return(0); // return success
}