函数名: intr
功 能: 改变软中断接口
用 法: #include <dos.h>
void intr(int intr_num, struct REGPACK *preg);
程序例:
#include <stdio.h>
#include <string.h>
#include <dir.h>
#include <dos.h>
#define CF 1 /* Carry flag */
int main(void)
{
char directory[80];
struct REGPACK reg;
printf("Enter directory to change to: ");
gets(directory);
reg.r_ax = 0x3B << 8; /* shift 3Bh into AH */
reg.r_dx = FP_OFF(directory);
reg.r_ds = FP_SEG(directory);
intr(0x21, ®);
if (reg.r_flags & CF)
printf("Directory change failed\n");
getcwd(directory, 80);
printf("The current directory is: %s\n", directory);
return 0;
}