Important: The information in this document is obsolete and should not be used for new development.
FSWrite
You can use theFSWrite
function to write data from a data buffer to an open driver.
pascal OSErr FSWrite(short refNum, long *count, const void *buffPtr);
refNum
- The driver reference number.
count
- The number of bytes to write.
buffPtr
- A pointer to the buffer that holds the data.
DESCRIPTION
TheFSWrite
function attempts to write the number of bytes indicated by thecount
parameter from the data buffer pointed to by thebuffPtr
parameter to the device driver specified by therefNum
parameter. After the transfer is complete, thecount
parameter indicates the number of bytes actually written.The
FSWrite
function is a high-level synchronous version of the low-levelPBWrite
function. Use thePBWrite
function when you want to request asynchronous writing or need to specify a drive number or a positioning mode and offset. See the next section, which describes thePBWrite
function.SPECIAL CONSIDERATIONS
Do not call theFSWrite
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 writErr -20 Driver does not respond to write 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 writing to device drivers, see the next section, which describes thePBWrite
function.