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/C++ v10.0 : C library - <b>synopsis:</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Synopsis:
    #include <dos.h>
    unsigned _dos_read( int handle, void __far *buffer,
                        unsigned count, unsigned *bytes );

Description:
    The _dos_read function uses system call 0x3F to read count bytes of data
    from the file specified by handle into the buffer pointed to by buffer.
     The number of bytes successfully read will be stored in the unsigned
    integer pointed to by bytes.

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

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

    EBADF
        Invalid file handle


See Also:
    _dos_close, _dos_open, _dos_write

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

    void main()
      {
        unsigned len_read;
        int      handle;
        auto char buffer[80];

        if( _dos_open( "file", O_RDONLY, &handle ) != 0 ) {
          printf( "Unable to open file\n" );
        } else {
          printf( "Open succeeded\n" );
          _dos_read( handle, buffer, 80, &len_read );
          _dos_close( handle );
        }
      }

Classification:
    DOS

Systems:
    DOS, Win, OS/2 1.x(all), OS/2 2.x, NT, DOS/PM

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