- int nWidth = lArray[CAPS_WIDTH];
- int nHorzRes = lArray[CAPS_HORIZONTAL_RESOLUTION]; // returns pel/meter
- *pnWidth = (nHorzRes/1000) * nWidth;
+ int nWidth = lArray[CAPS_WIDTH];
+ int nHorzRes = lArray[CAPS_HORIZONTAL_RESOLUTION]; // returns pel/meter
+ // use fp to avoid returning 0 if nHorzRes < 1000
+ *pnWidth = (int)((nHorzRes/1000.0) * nWidth);