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: Devices /
Chapter 1 - Device Manager / Device Manager Reference
Device Manager Functions / Communicating With Device Drivers


FSRead

You can use the FSRead function to read data from an open driver into a data buffer.

pascal OSErr FSRead(short refNum, long *count, void *buffPtr); 
refNum
The driver reference number.
count
The number of bytes to read.
buffPtr
A pointer to a buffer to hold the data.
DESCRIPTION
Before calling the FSRead function, your application should allocate a data buffer large enough to hold the data to be read. The FSRead function attempts to read the number of bytes indicated by the count parameter and transfer them to the data buffer pointed to by the buffPtr parameter. The refNum parameter identifies the device driver. After the transfer is complete, the count parameter indicates the number of bytes actually read.

WARNING
Be sure your buffer is large enough to hold the number of bytes specified by the count parameter, or this function may corrupt memory.
The FSRead function is a high-level synchronous version of the low-level PBRead function. Use the PBRead function when you want to request asynchronous reading or need to specify a drive number or a positioning mode and offset. See the next section, which describes the PBRead function.

SPECIAL CONSIDERATIONS
Do not call the FSRead function at interrupt time. Synchronous requests at interrupt time may block other pending I/O requests and cause the Device Manager to loop indefinitely while it waits for the device driver to complete the interrupted requests.

RESULT CODES
noErr0No error
readErr-19Driver does not respond to read requests
badUnitErr-21Driver reference number does not match unit table
unitEmptyErr-22Driver reference number specifies a nil handle in unit table
abortErr-27Request aborted by KillIO
notOpenErr-28Driver not open
SEE ALSO
For information about the low-level function for reading from device drivers, see the next section, which describes the PBRead function.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
3 JUL 1996