Name
intdos - Invokes a DOS system call.
Syntax
#include <dos.h>
int intdos(inregs, outregs)
union REGS *inregs;
union REGS *outregs;
Description
The intdos function invokes the DOS system call specified by
register values defined in inregs and returns the effect of
the system call in outregs. The inregs and outregs arguments
are unions of type REGS. The union type is defined in the
include file dos.h.
To invoke a system call, intdos executes an INT 21H
instruction. Before executing the instruction, the function
copies the contents of inregs to the corresponding
registers. After the INT instruction returns, intdos copies
the current register values to outregs. It also copies the
status of the system carry flag to the cflag field in
outregs. If this field is nonzero, the flag was set by the
system call and indicates an error condition.
The intdos function is used to invoke DOS system calls that
take arguments for input or output in registers other than
DX (DH/DL) and AL, or to invoke system calls that indicate
errors by setting the carry flag. Under any other
conditions, the function bdos can be used.
Do not use the intdos function to call interrupts that
modify the DS register. Instead use the intdosx or int86x
function. The intdosx and int86x functions load the DS and
ES registers from the segregs parameter and also store the
DS and ES registers into segregs after the function call.
Return Value
The intdos function returns the value of the AX register
after the system call is completed. If the cflag field in
outregs is nonzero, an error has occurred and _doserrno is
also set to the corresponding error code.
See Also
bdos(DOS), intdosx(DOS)
Example
#include <dos.h> #include <stdio.h>
union REGS inregs, outregs;
main()
{
/* Setup for get date function call (2A hex) */
inregs.h.ah = 0x2A;
/* Get current date: */
intdos(&inregs,&outregs);
printf("date is %d/%d/%d\n",
outregs.h.dh,outregs.h.dl,outregs.x.cx);
}
This program uses intdos to invoke DOS system call 2AH (get
the current date).
(printed 6/18/89)