Borland C++ reference

intdos

raw OCR

General DOS interrupt interface.

Defined in header <dos.h>

Syntax

#include <dos.h>
int intdos(union REGS *inregs, union REGS *outregs);

Portability

DOSUNIXWindowsANSI CC++ only
■■

Remarks

intdos executes DOS interrupt 0x21 to invoke a specified DOS function. The value of inregs -> h.ah specifies the DOS function to be invoked.

After the interrupt 0x21 returns, intdos 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. If the carry flag is set, it indicates that an error has occurred.

Note that inregs can point to the same structure that outregs points to.

Return value

intdos returns the value of AX after completion of the DOS function call. If the carry flag is set (outregs -> x.cflag != 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 near *filename)

   union REGS regs;
   int ret;
   regs.h.ah = 0x41;                             /* delete file */
   regs.x.dx = (unsigned) filename;
   ret = intdos(&regs, &regs);
   /* if carry flag is set, there was an error  */
   return(regs.x.cflag ? 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.