Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Text /
Chapter 5 - Text Utilities / Text Utilities Reference
Routines / Defining and Specifying Strings


GetString

The GetString function loads a string from a string ('STR ') resource into memory. It returns a handle to the string with the specified resource ID, reading it from the resource file if necessary.

FUNCTION GetString (stringID: Integer): StringHandle;
stringID
The resource ID of the string ('STR ') resource containing the string.
DESCRIPTION
The GetString function returns a handle to a string with the specified resource ID. If GetString cannot read the resource, it returns NIL.

GetString calls the GetResource function of the Resource Manager to access the string. This means that if the specified resource is already in memory, GetString simply returns its handle.

Like the NewString function, GetString returns a handle whose size is based upon the actual length of the string.

Note
If your application uses a large number of strings, it is more efficient to store them in a string list ('STR#') resource than as individual resources in the resource file. You then use the GetIndString procedure to access each string in the list.
SPECIAL CONSIDERATIONS
GetString does not create a copy of the string.

GetString may move memory; your application should not call this function at interrupt time.

ASSEMBLY-LANGUAGE INFORMATION
The trap macro for the GetString function is
Trap macro
_GetString


Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996