ImageGear for C and C++ on Linux v19.10 - Updated
LPFNIG_SEEK
API Reference Guide > Core Component API Reference > Core Component Callback Functions Reference > LPFNIG_SEEK

This function will be called during file operations when a SEEK is required.

Declaration:

 
Copy Code
typedef AT_INT(ACCUAPI LPFNIG_SEEK) ( 
        AT_INT fd, 
        AT_INT lOffset, 
        INT nFlag
);

Arguments:

Name Type Description
fd AT_INT File Descriptor handle.
lOffset AT_INT Offset to which to seek.
nFlag INT 0 = seek from start; 1 = seek from current position; 2 = seek from end.

Return Value:

Return offset into file at the completion of the seek, or -1 to indicate an error occurred.

Supported Raster Image Formats:

This function does not process image pixels.

Example:

 
Copy Code
HIGEAR        hIGear;       /* HIGEAR handle of image */
LPFNIG_READ   MyReadFunc;    /* To be called for READs */
LPFNIG_WRITE  MyWriteFunc;   /* To be called for WRITEs */
LPFNIG_SEEK   MySeekFunc;    /* To be called for SEEKs  */
{
/* Register Read, Write, and Seek callback functions:   */
IG_file_IO_register ( MyReadFunc, MyWriteFunc, MySeekFunc );
 ...
IG_save_file ( hIGear, "picture.bmp", IG_SAVE_BMP_UNCOMP );
 ...
}
/* This will be called for each seek during the above Save:  */
LONG ACCUAPI  MySeekFunc ( AT_INT fd, AT_INT lOffset, INT nFlag )
{
AT_INT   nResultOffset;
 ...
return  nResultOffset;
}

Remarks:

This type of function is established by calling IG_file_IO_register(). This function should return the offset into the file after the seek has completed, or -1 to indicate that an error occurred.