ImageGear for C and C++ on Windows v21.0 - Updated
API Reference Guide / Core Component API Reference / Core Component Functions Reference / Callback Register Functions / IG_file_IO_register
In This Topic
    IG_file_IO_register
    In This Topic

    This function registers your own functions to be called to do Reads, Writes, and Seeks during image file transfers.

    Declaration:

     
    Copy Code
    AT_ERRCOUNT ACCUAPI IG_file_IO_register (
            LPFNIG_READ lpfnReadFunc,
            LPFNIG_WRITE lpfnWriteFunc, 
            LPFNIG_SEEK lpfnSeekFunc 
    );
    

    Arguments:

    Name Type Description
    lpfnReadFunc LPFNIG_READ Far pointer to your function to be called for READs.
    lpfnWriteFunc LPFNIG_WRITE Far pointer to your function to be called for WRITEs.
    lpfnSeekFunc LPFNIG_SEEK Far pointer to your function to be called for SEEKs.

    Return Value:

    Returns the number of ImageGear errors that occurred during this function call.

    Supported Raster Image Formats:

    This function does not process image pixels.

    Sample:

    File IO

    Example:

     
    Copy Code
    LPFNIG_READ               MyReadFunc;      /* To be called for file READs */
    {
    HIGEAR           hIGear;     /* Will hold HIGEAR handle of image  */
     ...
    IG_file_IO_register ( MyReadFunc, NULL, NULL );/* Register it */
     ...
    IG_load_file ( "picture.bmp", &hIGear );
     ...
    }
    /* This will be called for each read during the above Load:   */
    LONG  ACCUAPI MyReadFunc ( LONG fd, LPBYTE lpBuffer, 
            LONG lNumToRead )
    {
    LONG     nNumActuallyRead;
     ...   /* May transfer bytes to buffer in any way     */
    return  nNumActuallyRead; /* Return count, or -1 for error  */
    }
    

    Remarks:

    An argument should be NULL if you want ImageGear to perform that operation. See also the descriptions for typedefs LPFNIG_READ, LPFNIG_WRITE, and LPFNIG_SEEK.