intdosx
General DOS interrupt interface.
Defined in header <dos.h>
Syntax
#include <dos.h>
int intdosx(union REGS *inregs, union REGS *outregs,
struct SREGS *segregs);
Portability
| DOS | UNIX | Windows | ANSI C | C++ only |
|---|---|---|---|---|
| ■ | ■ |
Remarks
intdosx executes DOS interrupt 0x21 to invoke a specified DOS function. The value of inregs -> h.ah specifies the DOS function to be invoked.
In addition, intdosx copies the segregs ->ds and segregs ->es values into the corresponding registers before invoking the DOS function. This feature allows programs that use far pointers or a large data memory model to specify which segment is to be used for the function execution.
After the interrupt 0x21 returns, intdosx copies the current register values to outregs, copies the status of the carry flag to the x.cflag field in outregs, and copies the value of the 8086 flags register to the x.flags field in outregs. In addition, intdosx sets the segregs ->es and segregs ->ds fields to the values of the corresponding segment registers and then restores DS. If the carry flag is set, it indicates that an error occurred.
intdosx lets you invoke a DOS function that takes a value of DS different from the default data segment and/or takes an argument in ES.
Note that inregs can point to the same structure that outregs points to.
Return value
intdosx returns the value of AX after completion of the DOS function call. If the carry flag is set (outregs -> x.cf lag ! = 0), indicating an error, it sets the global variable _doserrno to the error code.
See also
Example
#include <stdio.h>
#include <dos.h>
/* deletes file name; returns 0 on success, nonzero on failure */
int delete file (char far *filename)
union REGS regs; struct SREGS sregs;
int ret;
regs.h.ah = 0x41; /* delete file */
regs.x.dx = FP_OFF {filename);
sregs.ds = FP_SEG (filename);
ret = intdosx (®s, ®s, &sregs);
/* if carry flag is set, there was an error */
return(regs.x.c flag ? ret : 0);
int main(void)
{
int err;
err = delete_file("NOTEXIST.$$$") ;
if (!err)
printfC'Able to delete NOTEXIST.$$$\n") ;
else
printfC'Not Able to delete NOTEXIST.$$$\n");
return 0;
Differences from modern implementations
Nothing recorded yet.
Modern references
These are search links, not yet checked by hand.
Stable link: /3.1/dos.h/intdosx/
· short form /3.1/intdosx/