Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Watcom C Library Reference - <u>synopsis:</u> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Synopsis:
    #include <dos.h>
    unsigned _dos_write( int handle, void __far *buffer,
                         unsigned count, unsigned *bytes );

Description:
    The _dos_write function uses system call 0x40 to write count bytes of
    data from the buffer pointed to by buffer to the file specified by
    handle.  The number of bytes successfully written will be stored in the
    unsigned integer pointed to by bytes.

Returns:
    The _dos_write function returns zero if successful.  Otherwise, it
    returns an MS-DOS error code and sets  errno to one of the following
    values:

    Constant     Meaning

EACCES
    Access denied because the file is not open for write access

EBADF
    Invalid file handle


Example:
    #include <stdio.h>
    #include <dos.h>
    #include <fcntl.h>

    char buffer[] = "This is a test for _dos_write.";

    void main()
      {
        unsigned len_written;
        int      handle;

        if( _dos_creat( "file", _A_NORMAL, &handle ) != 0 ) {
          printf( "Unable to create file\n" );
        } else {
          printf( "Create succeeded\n" );
          _dos_write( handle, buffer, sizeof(buffer),
                      &len_written );
          _dos_close( handle );
        }
      }

Classification:
    DOS

Systems:
    DOS, Windows, Win386, Win32, OS/2 1.x(all), OS/2-32, DOS/PM

See Also:
    _dos_close, _dos_open, _dos_read

See Also: _dos_close _dos_open

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