Important: The information in this document is obsolete and should not be used for new development.
FSWrite
You can use theFSWritefunction 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
TheFSWritefunction attempts to write the number of bytes indicated by thecountparameter from the data buffer pointed to by thebuffPtrparameter to the device driver specified by therefNumparameter. After the transfer is complete, thecountparameter indicates the number of bytes actually written.The
FSWritefunction is a high-level synchronous version of the low-levelPBWritefunction. Use thePBWritefunction 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 thePBWritefunction.SPECIAL CONSIDERATIONS
Do not call theFSWritefunction 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 nilhandle in unit tableabortErr -27 Request aborted by KillIOnotOpenErr -28 Driver not open SEE ALSO
For information about the low-level function for writing to device drivers, see the next section, which describes thePBWritefunction.