Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

New Contributor
Posts: 3
Registered: ‎04-03-2012
My Device: Bold 9700
My Carrier: Bell

img_load_file need help

I am trying to load an image, using the example from the gesture tutorial and I am running into a problem.


I do this:


 rc = img_load_file(ilib, path, &callouts, &img);


and rc is equal to 9 and I am not sure what that means since the documentation uses "IMG_ERR_OK" and "IMG_ERR_CORRUPT"


Here is a link to the documentation I am talking about above: https://developer.blackberry.com/native/reference/com.qnx.doc.libimg.lib_ref/com.qnx.doc.neutrino.li... 


I am guessing the error is IMG_ERR_TRUNC, but I am not sure how that can be, since I am copying the image from the Gesture example, and that works fine.

Posts: 499
Registered: ‎05-07-2012
My Device: developer
My Carrier: developer

Re: img_load_file need help

From target/qnx6/usr/include/img/img_errno.h:


#define IMG_ERR_OK            0
#define IMG_ERR_TRUNC        1    /* premature EOF */
#define IMG_ERR_CORRUPT        2    /* unrecoverable error in data stream */
#define IMG_ERR_FORMAT        3    /* file format not recognized */
#define IMG_ERR_NODATA        4    /* no data present */
#define IMG_ERR_NOSUPPORT    5    /* request value/format/conversion not supported */
#define IMG_ERR_MEM            6    /* memory allocation error */
#define IMG_ERR_CFG            7    /* bad or missing config file */
#define IMG_ERR_DLL            8    /* error accessing dll or entrypoint */
#define IMG_ERR_FILE        9    /* file access error */
#define IMG_ERR_INTR        10    /* operation interrupted by application */
#define IMG_ERR_PARM        11    /* invalid parameter */
#define IMG_ERR_NOTIMPL        12    /* operation not implemented */


So you are getting a file access error.  I suggest just opening the file and checking errno for more details.