ImageGear for C and C++ on Linux v18.8 - Updated
LPFNIG_WRITE
API Reference Guide > Core Component API Reference > Core Component Callback Functions Reference > LPFNIG_WRITE

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

Declaration:

 
Copy Code
typedef LONG (ACCUAPI LPFNIG_WRITE) ( 
        LONG fd, 
        const LPBYTE lpBuffer, 
        LONG lSize 
);

Arguments:

Name Type Description
fd LONG File Descriptor handle.
lpBuffer const LPBYTE Far pointer to buffer from which to write.
lSize LONG Number of bytes to write.

Return Value:

Return the number of bytes written, or -1 to indicate that an error occurred.

Supported Raster Image Formats:

This function does not process image pixels.

Example:

 
Copy Code
HIGEAR       hIGear;        /* HIGEAR handle of image */
LPFNIG_WRITE  MyWriteFunc; /* To be called for file WRITEs */
{
IG_file_IO_register ( NULL, MyWriteFunc, NULL );    /* Register it */
 ...
IG_save_file ( hIGear, "picture.bmp", IG_SAVE_BMP_UNCOMP );
 ...
}
/* This will be called for each write during the above Save:  */
LONG ACCUAPI  MyWriteFunc ( LONG fd, LPBYTE lpBuffer, LONG lNumToWrite )
{
LONG     nNumActuallyWritten;
 ...
return  nNumActuallyWritten; /* Return count, or -1 for error  */

Remarks:

This type of function is established by calling IG_file_IO_register().