Important: The information in this document is obsolete and should not be used for new development.
FSRead
You can use theFSRead
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 theFSRead
function, your application should allocate a data buffer large enough to hold the data to be read. TheFSRead
function attempts to read the number of bytes indicated by thecount
parameter and transfer them to the data buffer pointed to by thebuffPtr
parameter. TherefNum
parameter identifies the device driver. After the transfer is complete, thecount
parameter 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
count
parameter, or this function may corrupt memory.FSRead
function is a high-level synchronous version of the low-levelPBRead
function. Use thePBRead
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 thePBRead
function.SPECIAL CONSIDERATIONS
Do not call theFSRead
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
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 nil
handle in unit tableabortErr -27 Request aborted by KillIO
notOpenErr -28 Driver not open SEE ALSO
For information about the low-level function for reading from device drivers, see the next section, which describes thePBRead
function.