Important: The information in this document is obsolete and should not be used for new development.
InsertRecordToDictionary
TheInsertRecordToDictionaryfunction 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
keyparameter.DESCRIPTION
TheInsertRecordToDictionaryfunction places the specified record into the specified dictionary. TherecordDataHandleparameter 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 therecordDataHandleparameter exceeds the maximum of 4096 bytes,InsertRecordToDictionaryreturns arecordDataTooBigErrresult code.The
whichModeparameter 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
InsertRecordToDictionaryreturns one of the errors listed in "Result Codes," the specified record was not inserted or replaced.SPECIAL CONSIDERATIONS
InsertRecordToDictionarymay 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,InsertRecordToDictionarycan return one of the following result codes.
n oErr0 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
InsertRecordToDictionaryfunction, see Listing 8-5 on page 8-19.