Important: The information in this document is obsolete and should not be used for new development.
PtrToHand
To copy data referenced by a pointer to a new relocatable block, use thePtrToHandfunction.
FUNCTION PtrToHand (srcPtr: Ptr; VAR dstHndl: Handle; size: LongInt): OSErr;
srcPtr- The address of the first byte to copy.
dstHndl- A handle for which you have not yet allocated any memory. The
PtrToHandfunction allocates memory for the handle and copiessizebytes beginning atsrcPtrinto it.size- The number of bytes to copy.
DESCRIPTION
ThePtrToHandfunction returns, indstHndl, a newly created handle to a copy of the number of bytes specified by thesizeparameter, beginning at the location specified bysrcPtr. ThedstHndlparameter must be a handle variable that is not empty and is not a handle to an allocated block of size 0.SPECIAL CONSIDERATIONS
BecausePtrToHandallocates memory, you should not call it at interrupt time.ASSEMBLY-LANGUAGE INFORMATION
The registers on entry and exit forPtrToHandare
Registers on entry A0 Pointer to source D0 Number of bytes to copy
Registers on exit A0 Destination handle D0 Result code RESULT CODES
noErr 0 No error memFullErr -108 Not enough memory SEE ALSO
You can use thePtrToHandfunction to copy data from one handle to a new handle
if you dereference and lock the source handle. However, if you want to copy all of
the data from one handle to another, theHandToHandfunction (described on page 2-62) is more efficient.