home *** CD-ROM | disk | FTP | other *** search
- /**
- *
- * Name flread -- Read from a file to a buffer
- *
- * Synopsis ercode = flread(handle,pbufads,nbytes,pnread);
- *
- * int ercode DOS function return error code
- * int handle File handle
- * ADS *pbufads Segment, offset address of input buffer
- * unsigned nbytes Number of bytes to read
- * unsigned *pnread Number of bytes actually returned
- *
- * Description FLREAD transfers the specified number of bytes (nbytes)
- * from the file (whose handle is specified) to a buffer
- * whose segment and offset address is pointed to by
- * pbufads. The number of bytes actually read is also
- * returned. The file pointer is moved the number of bytes
- * read; therefore, successive calls to FLREAD sequentially
- * read the file.
- *
- * Returns ercode DOS function error code
- * *pnread The number of bytes transferred to the
- * I/O buffer.
- *
- * Version 3.0 (C)Copyright Blaise Computing Inc. 1983, 1984, 1986
- *
- **/
-
- #include <bfile.h>
-
- int flread(handle,pbufads,nbytes,pnread)
- int handle;
- ADS *pbufads;
- unsigned nbytes,*pnread;
- {
- DOSREG dos_reg;
- int ercode;
-
- dos_reg.ax = 0x3f00; /* DOS function 0x3F */
- dos_reg.bx = handle;
- dos_reg.cx = nbytes;
- dos_reg.dx = pbufads->r;
- dos_reg.ds = pbufads->s;
- ercode = dos(&dos_reg);
- *pnread = dos_reg.ax;
-
- return(ercode);
- }