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


FSWrite

You can use the FSWrite 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
The FSWrite function attempts to write the number of bytes indicated by the count parameter from the data buffer pointed to by the buffPtr parameter to the device driver specified by the refNum parameter. After the transfer is complete, the count parameter indicates the number of bytes actually written.

The FSWrite function is a high-level synchronous version of the low-level PBWrite function. Use the PBWrite 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 the PBWrite function.

SPECIAL CONSIDERATIONS
Do not call the FSWrite 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
writErr-20Driver does not respond to write 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 writing to device drivers, see the next section, which describes the PBWrite function.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
3 JUL 1996