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 8 - Dictionary Manager / Dictionary Manager Reference
Routines / Accessing a Dictionary


OpenDictionary

The OpenDictionary function creates an access path to the specified dictionary file.

FUNCTION OpenDictionary (theFSSpecPtr: FSSpecPtr;
                         accessPermission: SignedByte;
                         VAR dictionaryReference: LongInt)
                         : OSErr;
theFSSpecPtr
A pointer to the file system specification record for the file to open. This record contains the filename, directory, and volume associated with this dictionary file.
accessPermission
The read and write permission for the access path. This permission must follow the File Manager access permission conventions.
dictionaryReference
A number that specifies a particular open dictionary.
DESCRIPTION
The OpenDictionary function returns, in the dictionaryReference parameter, a dictionary reference number--an identifying value that you use to specify the dictionary in subsequent calls to the Dictionary Manager.

The data structures accessed through the dictionaryReference parameter are allocated in the current heap. If the same dictionary is to be shared across applications, make sure the current zone is the system zone, so the data structures will be allocated in the system heap.

The following constants define the allowed values for the accessPermission parameter:
ConstantValueExplanation
fsRdPerm1Request read permission only
fsWrPerm2Request write permission only
fsRdWrPerm3Request exclusive read/write permission

If the requested permission is not granted, OpenDictionary returns a result code that specifies the type of error.

SPECIAL CONSIDERATIONS
OpenDictionary 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, OpenDictionary may return any of the following result codes.
noErr0No error
notBTree-410File is not a dictionary

SEE ALSO
File system specification records, File Manager access permissions, and 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 OpenDictionary function, see Listing 8-2 on page 8-13.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996