| cvs.gedasymbols.org/djgpp/doc/libc/libc_177.html | search | 
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] | 
#include <dos.h>
unsigned int _dos_read(int handle, void *buffer, unsigned int count,
                       unsigned int *result);
 | 
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.
See also _dos_open, _dos_creat, _dos_creatnew, _dos_write, and _dos_close.
Returns 0 if successful or DOS error code on error (and sets errno
to EACCES or EBADF)
| ANSI/ISO C | No | 
| POSIX | No | 
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);
}
 | 
| webmaster | delorie software privacy | 
| Copyright © 2004 | Updated Apr 2004 |