Important: The information in this document is obsolete and should not be used for new development.
FSRead
You can use theFSReadfunction 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 theFSReadfunction, your application should allocate a data buffer large enough to hold the data to be read. TheFSReadfunction attempts to read the number of bytes indicated by thecountparameter and transfer them to the data buffer pointed to by thebuffPtrparameter. TherefNumparameter identifies the device driver. After the transfer is complete, thecountparameter indicates the number of bytes actually read.
The
- WARNING
- Be sure your buffer is large enough to hold the number of bytes specified by the
countparameter, or this function may corrupt memory.![]()
FSReadfunction is a high-level synchronous version of the low-levelPBReadfunction. Use thePBReadfunction 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 thePBReadfunction.SPECIAL CONSIDERATIONS
Do not call theFSReadfunction 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
noErr 0 No error readErr -19 Driver does not respond to read requests badUnitErr -21 Driver reference number does not match unit table unitEmptyErr -22 Driver reference number specifies a nilhandle in unit tableabortErr -27 Request aborted by KillIOnotOpenErr -28 Driver not open SEE ALSO
For information about the low-level function for reading from device drivers, see the next section, which describes thePBReadfunction.