_intdos

Description

Executes a DOS system call.

#include <dos.h>

int _intdos( union _REGS *inregs, union _REGS *outregs );

inregs Register values on call  
outregs Register values on return  

Remarks

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 _REGS 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. A nonzero cflag field indicates the flag was set by the system call and also 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. The _intdos function is also used to invoke system calls that indicate errors by setting the carry flag. Under any other conditions, the _bdos function can be used.

Do not use the _intdos function to call interrupts that modify the DS register. Instead, use the _intdosx or _int86x function.

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.

Compatibility

Standards:None

16-Bit:DOS, QWIN, WIN, WIN DLL

32-Bit:None

See Also

_bdos, _intdosx

Example

/* INTDOS.C: This program uses _intdos to invoke DOS system call 2AH

* (gets the current date).

*/

#include <dos.h>

#include <stdio.h>

void main( void )

{

union _REGS inregs, outregs;

inregs.h.ah = 0x2a; /* DOS Get Date function: */

_intdos( &inregs, &outregs );

printf( “Date: %d/%d/%d\n”, outregs.h.dh, outregs.h.dl, outregs.x.cx );

}

Output

Date: 6/16/1999