Important: The information in this document is obsolete and should not be used for new development.
InsertRecordToDictionary
TheInsertRecordToDictionary
function inserts a dictionary record into the specified dictionary file.
FUNCTION InsertRecordToDictionary (dictionaryReference: LongInt; key: Str255; recordDataHandle: Handle; whichMode: InsertMode): OSErr;
dictionaryReference
- A number that specifies a particular open dictionary.
key
- A Pascal string that denotes the key of the record to be inserted.
recordDataHandle
- A handle containing the data for the new record.
whichMode
- A value that determines whether the inserted record is to replace a record in the dictionary whose key matches the
key
parameter.DESCRIPTION
TheInsertRecordToDictionary
function places the specified record into the specified dictionary. TherecordDataHandle
parameter must be a handle to data formatted like the data of a dictionary record, as shown in Figure 8-2 on page 8-6. Each entry in the data must be formatted as shown in Figure 8-3 on page 8-7. If the data size referenced by therecordDataHandle
parameter exceeds the maximum of 4096 bytes,InsertRecordToDictionary
returns arecordDataTooBigErr
result code.The
whichMode
parameter controls the insertion mode, the manner in which the insertion can take place. There are three possibilities, for which the Dictionary Manager defines three constants:If
InsertRecordToDictionary
returns one of the errors listed in "Result Codes," the specified record was not inserted or replaced.SPECIAL CONSIDERATIONS
InsertRecordToDictionary
may move memory; your application should not call this function at interrupt time.RESULT CODES
In addition to the standard File Manager, Memory Manager, and Resource Manager errors,InsertRecordToDictionary
can return one of the following result codes.
n oErr
0 No error n otBTree
-410 File is not a dictionary btNoSpace -413 Insufficient disk space to store dictionary btDupRecErr -414 Record already exists btRecNotFnd -415 Record cannot be found btKeyLenErr -416 Key length too great or equal to zero unknownInsertModeErr -20000 No such insertion mode recordDataTooBigErr -20001 Entry data bigger than buffer size SEE ALSO
File Manager error codes are described in Inside Macintosh: Files. Memory Manager error codes are described in Inside Macintosh: Memory. Resource Manager error codes are described in Inside Macintosh: More Macintosh Toolbox.For sample code that uses the
InsertRecordToDictionary
function, see Listing 8-5 on page 8-19.