home *** CD-ROM | disk | FTP | other *** search
- @node _dos_write, dos
- @subheading Syntax
-
- @example
- #include <dos.h>
-
- unsigned int _dos_write(int handle, const void *buffer, unsigned int count,
- unsigned int *result);
- @end example
-
- @subheading Description
-
- 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 @var{count} bytes from @var{buffer} to @var{handle}.
- @var{count} value may be arbitrary size (e.g. > 64KB). It puts number of
- bytes written into @var{result} if writing is successful.
-
- @xref{_dos_open}. @xref{_dos_creat}. @xref{_dos_creatnew}.
- @xref{_dos_read}. @xref{_dos_close}
-
- @subheading Return Value
-
- Returns 0 if successful or DOS error code on error (and sets @var{errno}
- to EACCES or EBADF)
-
- @subheading Example
-
- @example
- 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);
- @}
- @end example
-