home *** CD-ROM | disk | FTP | other *** search
- /**
- *
- * Name flwrite -- Write to a file from a buffer
- *
- * Synopsis ercode = flwrite(handle,pbufads,nbytes,pnwrote);
- *
- * int ercode Returned DOS function code
- * int handle File handle
- * ADS *pbufads Segment, offset address of I/O buffer
- * unsigned nbytes Number of bytes to write
- * unsigned *pnwrote Number of bytes actually written
- *
- * Description This function writes nbytes from the buffer whose
- * address is specified in pbufads to the file associated
- * with the given handle. The number of bytes actually
- * written is returned in *pnwrote. The file pointer is
- * moved the number of bytes actually written. The ADS
- * type is used for the buffer to allow I/O buffers outside
- * the default data segment.
- *
- * Returns ercode DOS function error return code
- * *pnwrote The number of bytes written to the file.
- *
- * Version 3.0 (C)Copyright Blaise Computing Inc. 1983, 1984, 1986
- *
- **/
-
- #include <bfile.h>
-
- int flwrite(handle,pbufads,nbytes,pnwrote)
- int handle;
- ADS *pbufads;
- unsigned nbytes,*pnwrote;
- {
- DOSREG dos_reg;
- int ercode;
-
- dos_reg.ax = 0x4000; /* DOS function 0x40 */
- dos_reg.bx = handle;
- dos_reg.cx = nbytes;
- dos_reg.dx = pbufads->r;
- dos_reg.ds = pbufads->s;
- ercode = dos(&dos_reg);
- *pnwrote = dos_reg.ax;
-
- return(ercode);
- }