REDIRECTCLOSE

#include "l_bitmap.h"

L_INT pEXT_CALLBACK YourClose (nFd, pUserData)

Replaces the normal LEADTOOLS function for closing a file.

Parameters

nFD

Identifies the file to be closed. The file handle is returned by the REDIRECTOPEN callback function.

L_VOID *pUserData

A void pointer that you can use to access a variable or structure containing data that your callback function needs. This gives you a way to receive data indirectly from the function that uses this callback function. (This is the same pointer that you pass in the pUserData parameter of the calling function.)

Keep in mind that this is a void pointer, which must be cast to the appropriate data type within your callback function.

Returns

Value Meaning
0 The file was closed.
-1 The function failed.

Comments

For information about using this type of callback, refer to L_RedirectIO.

Required DLLs and Libraries

Example

For how the following function is defined and called, refer to L_RedirectIO. This procedure is a replacement to the built in Close procedure. This may be called many times, especially by L_FileInfo, so we need to reset the internal data structure to the defaults.

/************************** Global Declarations **********************************/ 
 
typedef struct tagUSERDATA 
{ 
   L_INT32 dwSize; /* Size of the buffer. */ 
   L_INT32 dwUsed; /* Number of bytes used. */ 
   L_CHAR *pData; /* Pointer to the buffer. */ 
   L_CHAR *pCurData; /* Current pointer location. */ 
} USERDATA, * LPUSERDATA; /* Pointer to DATA structure */ 
  
static USERDATA UserData; 
/******************************************************************************/ 
 
L_INT WindowsClose (L_INT FD) 
{ 
   UNREFERENCED_PARAMETER (FD); 
 
   UserData.pCurData = UserData.pData; 
   UserData.dwUsed = 0; 
   return (TRUE); 
} 

Help Version 20.0.2020.4.3
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2020 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C API Help