qc.hlp (Table of Contents; Topic list)
write
 Summary Example                         Up Contents Index Back
────────────────────────────────────────────────────────────────────────────
 
     The write function writes <count> bytes from <buffer> into the
     file associated with <handle>. The write operation begins at the
     current position of the file pointer (if any) associated with the
     given file. If the file is open for appending, the operation
     begins at the current end of the file. After the write operation,
     the file pointer is increased by the number of bytes actually
     written.
 
     Return Value
 
     The write function returns the number of bytes actually written.
     The return value may be positive but less than <count> (for
     example, when write runs out of disk space before <count> bytes
     are written).
 
     A return value of -1 indicates an error. In this case, errno is
     set to either EBADF or ENOSPC.
 
     If you are writing more than 32K (the maximum size for type int)
     to a file, the return value should be of type unsigned. However,
     the maximum number of bytes that can be written to a file at one
     time is 65,534, since 65,535 (or 0xFFFF) is indistinguishable from
     -1, and would return an error.
 
     If the file is opened in text mode, each line-feed character is
     replaced with a carriage-return──line-feed pair in the output. The
     replacement does not affect the return value.
 
     When writing to files opened in text mode, the write function
     treats a CTRL+Z character as the logical end-of-file. When writing
     to a device, write treats a CTRL+Z character in the buffer as an
     output terminator.
                                    -♦-