Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- libc - <b>_dos_read</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
_dos_read
=========

Syntax
------

     #include <dos.h>
     
     unsigned int _dos_read(int handle, void *buffer, unsigned int count, unsigned int *result);

Description
-----------

This is a direct connection to the MS-DOS read function call (%ah =
0x3F).  No conversion is done on the data; it is read as raw binary
data. This function reads from HANDLE into BUFFER COUNT bytes.  COUNT
value may be arbitrary size (for example > 64KB). It puts number of
bytes read into RESULT if reading is successful.

_dos_open:. _dos_creat:. _dos_creatnew:.  *Note         
_dos_write::. _dos_close:    

Return Value
------------

Returns 0 if successful or DOS error code on error (and sets ERRNO to
EACCES or EBADF)

Example
-------

     int handle;
     unsigned int result;
     char *filebuffer;
     
     if ( !_dos_open("FOO.DAT", O_RDONLY, &handle) )
     {
        puts("FOO.DAT openning was successful.");
        if ( (filebuffer = malloc(130000)) != NULL )
        {
          if ( !_dos_read(handle, buffer, 130000, &result) )
            printf("%u bytes read from FOO.DAT.\n", result);
          else
            puts("Reading error.");
          ...
          /* Do something with filebuffer. */
          ...
        }
        _dos_close(handle);
     }


See Also: _dos_open _dos_creat _dos_creatnew _dos_close

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