| www.delorie.com/djgpp/doc/libc/libc_185.html | search | 
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] | 
| #include <dos.h>
unsigned int _dos_write(int handle,
                        const void *buffer, unsigned int count,
                        unsigned int *result);
 | 
This is a direct connection to the MS-DOS write function call (%ah = 0x40). No conversion is done on the data; it is written as raw binary data. This function writes count bytes from buffer to handle. count value may be arbitrary size (e.g. > 64KB). It puts the number of bytes written into result if writing is successful.
See also _dos_open, _dos_creat, _dos_creatnew, _dos_read, 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_creat("FOO.DAT", _A_ARCH, &handle) )
{
   puts("FOO.DAT creating was successful.");
   if ( (filebuffer = malloc(130000)) != NULL )
   {
     ...
     /* Put something into filebuffer. */
     ...
     if ( !_dos_write(handle, buffer, 130000, &result) )
       printf("%u bytes written into FOO.DAT.", result);
     else
       puts("Writing error.");
   }
   _dos_close(handle);
}
 | 
| webmaster | delorie software privacy | 
| Copyright © 2004 | Updated Apr 2004 |