Important: The information in this document is obsolete and should not be used for new development.
NewString
TheNewStringfunction allocates memory in the heap for a string, copies its contents, and produces a handle for the heap version of the string.
FUNCTION NewString (theString: Str255): StringHandle;
theString- A Pascal string that you want copied onto the heap.
DESCRIPTIONNewStringreturns a handle to the newly allocated string. If the string cannot be allocated,NewStringreturnsNIL. The size of the allocated string is based on the actual length oftheString, which may not be 255 bytes.
- Note
- Before using Pascal string functions that can change the length of the string, it is a good idea to maximize the size of the string object on the heap. You can call either the
SetStringprocedure or the Memory Manager procedureSetHandleSizeto modify the string's size.![]()
SPECIAL CONSIDERATIONS
NewStringmay move memory; your application should not call this function at interrupt time.ASSEMBLY-LANGUAGE INFORMATION
The trap macro for theNewStringfunction is
Trap macro _NewString