home *** CD-ROM | disk | FTP | other *** search
- /**
- *
- * Name flseek -- Position the file pointer
- *
- * Synopsis ercode = flseek(handle,mov,ppos);
- *
- * int ercode DOS error return code
- * int handle Handle of file to be positioned
- * int mov Positioning technique
- * long *ppos File position
- *
- * Description Each handle of an open file has a file position pointer
- * associated with it. FLSEEK moves the pointer using the
- * technique specified in mov. The possibilities are:
- *
- * ABSOLUTE (0) - Move the pointer to the offset specified
- * in *ppos from the beginning of the file.
- * RELATIVE (1) - Move the pointer to the specified offset
- * relative to the current file position.
- * ENDFILE (2) - Move the pointer to the offset from
- * the end of the file.
- *
- * Upon input, *ppos contains the offset in bytes to move
- * the file pointer, and upon return, the new file pointer
- * location. The functions FLREAD and FLWRITE also alter
- * the file pointer position.
- *
- * Returns ercode DOS 2.0 function error return code
- * *ppos The file pointer position after the seek
- * has been accomplished. If an error is
- * encountered, the position is set to -1.
- *
- * Version 3.0 (C)Copyright Blaise Computing Inc. 1983, 1984, 1986
- *
- **/
-
- #include <bfile.h>
-
- int flseek(handle,mov,ppos)
- int handle,mov;
- long *ppos;
- {
- DOSREG dos_reg;
- int ercode;
-
- dos_reg.ax = utbyword(0x42,mov); /* Function call 0x42 */
- dos_reg.bx = handle;
- dos_reg.cx = (unsigned) uthiword(*ppos); /* High order and */
- dos_reg.dx = (unsigned) utloword(*ppos); /* low order words */
- ercode = dos(&dos_reg);
- if (ercode == 0)
- *ppos = (((long)(dos_reg.dx)) << 16) + (long)dos_reg.ax;
- else
- *ppos = -1L;
-
- return(ercode);
- }