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 / Reading in Edition Data


ReadEdition

Use the ReadEdition function to read data from an edition. This function reads from the current mark for the specified format.

FUNCTION ReadEdition (whichEdition: EditionRefNum; 
                      whichFormat: FormatType; buffPtr: UNIV Ptr;
                      VAR buffLen: Size): OSErr;
whichEdition
The reference number for the edition.
whichFormat
The format type that you want to read.
buffPtr
A pointer to the buffer into which you want to read the data.
buffLen
The number of bytes that you want to read into the buffer. The ReadEdition function returns the actual number of bytes read in the buffLen parameter.
DESCRIPTION
The ReadEdition function reads data from the edition into the specified buffer. ReadEdition returns in the buffLen parameter the total number of bytes read into the buffer. If the buffLen parameter returns a value smaller than the value you have specified, there is no additional data to read, and the ReadEdition function returns a noErr result code. If you use the ReadEdition function after all data is read in, the ReadEdition function returns an eofErr result code.

You can read data from an edition while a publisher on the same machine is writing data to the same edition. The data that you are reading is the old edition (not the data that the publisher is writing). If the publisher finishes writing data before you are through reading the old edition data, the ReadEdition function returns an abortErr result code. If the ReadEdition function returns an abortErr result code, you should stop trying to read data and use the CloseEdition function with the successful parameter set to FALSE.

Note
The Translation Manager (if it is available) attempts implicit translation under certain circumstances. For instance, it does so when your application attempts to read from an edition a format type that is not in the edition. In this case, the Translation Manager attempts to translate the data into the requested format. For more information, see the chapter "Translation Manager" in Inside Macintosh: More Macintosh Toolbox.
RESULT CODES
noErr0No error
abortErr-27Publisher has written a new edition
ioErr-36I/O error
fnOpnErr-38File not open
eofErr-39No more data of that format
rfNumErr-51Bad edition reference number
noTypeErr-102Format not available
editionMgrInitErr-450Manager not initialized
SEE ALSO
For an example of the use of ReadEdition, see Listing 2-7 beginning on page 2-42.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996