Carbon


PtrToHand

Header: MacMemory.h Carbon status: Supported

Copies data referenced by a pointer to a new relocatable block.

OSErr PtrToHand (
    const void *srcPtr, 
    Handle *dstHndl, 
    SInt32 size
);
srcPtr

The address of the first byte to copy.

dstHndl

A handle for which you have not yet allocated any memory. The PtrToHand function allocates memory for the handle and copies the specified number of bytes beginning at srcPtr into it. The dstHndl parameter must be a nonempty handle variable, not a handle to an allocated block of size 0.

size

The number of bytes to copy.

function result

A result code. A result code.

DISCUSSION

If you dereference and lock a handle, the PtrToHand function can copy its data to a new handle. However, for copying data from one handle to another, the HandToHand function is more efficient.

Because PtrToHand allocates memory, you should not call it at interrupt time.

AVAILABILITY

Supported in Carbon. Available in CarbonLib 1.0 and later when InterfaceLib 7.1 or later is installed. Exported by CarbonLib 1.0 and later and by InterfaceLib 7.1 and later.


© 2000 Apple Computer, Inc. — (Last Updated 4/6/2000)