Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Borland C++ 2.x ( with Turbo C ) - <b>_write() write data to a file</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 _write()                Write Data to a File

 #include   <io.h>

 int        _write(handle,buf,nbyte);
 int        handle;                      Handle associated with file
 void       *buf;                        Buffer
 int        nbyte;                       Number of bytes to be written

    _write() writes 'nbyte' bytes from buffer 'buf' to the file
    associated with 'handle', obtained from one of the following calls:
    creat(), open(), dup() dup2(), or fcntl().

    If the handle is associated with a file, writing always begins at the
    current position of the file pointer.  If the handle is associated
    with a device, the bytes are sent to the device directly.
            
        Return:     The number of bytes written, if successful.  On
                    error, -1 is returned and 'errno' is set to one of
                    the following:

                    EACCES         Permission denied
                    EBADF          Bad file number

                    The number of bytes written may be less than the
                    number requested.  If this happens, the disk is
                    probably full, and the condition should be considered
                    an error.

                    If more than 32k bytes are to be written, the return
                    value should be of type unsigned int. The maximum
                    number of bytes that can be written to a file is
                    65534, because 65535 (0xFFFF) is indistinguishable
                    from -1.

         Notes:     _write() does not do a (LF) to (CR-LF) translation
                    because all of its files are considered binary.

   Portability:     MS-DOS only.


See Also: write()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson