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
);
Parameter descriptions
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 Carbon 1.0.2 and later when running Mac OS 8.1 or later.


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