version 2003
PA_GetHandleSize (handle) long
| Parameter | Type | Description | |
| handle | PA_Handle | Handle to a block of memory | |
| Function result | long | Size of the data led to by handle |
Description
The routine PA_GetHandleSize returns the size of the data led to by handle in bytes.
Handle should be a PA_Handle allocated by PA_NewHandle.
Example
Create a new handle that duplicates an existing handle.
PA_Handle DuplicateHandle( PA_Handle hsrc )
{
long size;
PA_Handle hdest;
char *pSrc, *pDest;
// get the source handle size
size = PA_GetHandleSize( hsrc );
// make duplicate handle and copy data to it
hdst = PA_NewHandle( size );
if ( hdest )
{
pSrc = PA_LockHandle( hsrc );
pDest = PA_LockHandle( hdest );
PA_MoveBlock( pSrc, pDest, size );
PA_UnlockHandle( srce );
PA_Unlockhandle( hdest );
}
return hdest;
}
See Also
PA_NewHandle, PA_SetHandleSize.
Error Handling
Use PA_GetLastError to see if an error occurred (not a valid handle, etc.).