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: Interapplication Communication /
Chapter 2 - Edition Manager / Edition Manager Reference
Edition Manager Routines / Closing an Edition After Reading or Writing


CloseEdition

Use the CloseEdition function to close an edition after you finish reading from or writing to it.

FUNCTION CloseEdition (whichEdition: EditionRefNum; 
                       successful: Boolean): OSErr;
whichEdition
The reference number for the edition.
successful
A value that indicates whether your application was successful (TRUE) or unsuccessful (FALSE) in reading from or writing data to the edition.
DESCRIPTION
When a subscriber successfully finishes reading data from the edition, the CloseEdition function takes the modification date of the edition file that you have read and puts it in the mdDate field of the subscriber's section record. This indicates that the data contained in the edition and the subscriber section within the document are the same.

When a subscriber is unsuccessful in reading data from an edition (because there is not enough memory, or you didn't find a format that you can read), set the successful parameter to FALSE. The CloseEdition function then closes the edition, but does not set the mdDate field. This implies that the subscriber is not updated with the latest edition.

When a publisher successfully finishes writing data to an edition, the CloseEdition function makes the data that the publisher has written to the edition available to any subscribers and sets the corresponding edition file's modification date (ioFlMdDat) to the mdDate field of the publisher's section record. The Edition Manager then sends a Section Read event to all current subscribers set to automatic update mode. At this point, the file type of the edition file is set based on the first known format that the publisher wrote.

When a publisher is unsuccessful in writing data to an edition, the CloseEdition function discards what the publisher has written to the edition. The data contained in the edition prior to writing remains unchanged, and Section Read events are not sent to subscribers.

RESULT CODES
noErr0No error
ioErr-36I/O error
fnOpnErr-38File not open
rfNumErr-51Bad edition reference number
editionMgrInitErr-450Manager not initialized
SEE ALSO
For an example of the use of CloseEdition, see Listing 2-5 beginning on
page 2-36.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996