墙角野猫 发表于 2006-7-12 23:53

函数名: int86
功 能: 通用8086软中断接口
用 法: int int86(int intr_num, union REGS *inregs, union REGS *outregs);
程序例:
#include
#include
#include
#define VIDEO 0x10
void movetoxy(int x, int y)
{
union REGS regs;
regs.h.ah = 2; /* set cursor postion */
regs.h.dh = y;
regs.h.dl = x;
regs.h.bh = 0; /* video page 0 */
int86(VIDEO, ?s, ?s);
}
int main(void)
{
clrscr();
movetoxy(35, 10);
printf("Hello
");
return 0;
}

墙角野猫 发表于 2006-7-12 23:54

函数名: int86x
功 能: 通用8086软中断接口
用 法: int int86x(int intr_num, union REGS *insegs, union REGS *outregs,
struct SREGS *segregs);
程序例:
#include
#include
#include
int main(void)
{
char filename;
union REGS inregs, outregs;
struct SREGS segregs;
printf("Enter filename: ");
gets(filename);
inregs.h.ah = 0x43;
inregs.h.al = 0x21;
inregs.x.dx = FP_OFF(filename);
segregs.ds = FP_SEG(filename);
int86x(0x21, &inregs, &outregs, &segregs);
printf("File attribute: %X
", outregs.x.cx);
return 0;
}

墙角野猫 发表于 2006-7-12 23:54

函数名: intdos
功 能: 通用DOS接口
用 法: int intdos(union REGS *inregs, union REGS *outregs);
程序例:
#include
#include
/* 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(?s, ?s);
/* 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)
printf("Able to delete NOTEXIST.$$$
");
else
printf("Not Able to delete NOTEXIST.$$$
");
return 0;
}

墙角野猫 发表于 2006-7-12 23:55

还有好多啊......累死了~~~~~~~~

墙角野猫 发表于 2006-7-13 00:03

继续来啊~

墙角野猫 发表于 2006-7-13 00:04

函数名: intdosx
功 能: 通用DOS中断接口
用 法: int intdosx(union REGS *inregs, union REGS *outregs,
struct SREGS *segregs);
程序例:
#include
#include
/* 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.cflag ? ret : 0);
}
int main(void)
{
int err;
err = delete_file("NOTEXIST.$$$");
if (!err)
printf("Able to delete NOTEXIST.$$$
");
else
printf("Not Able to delete NOTEXIST.$$$
");
return 0;
}

墙角野猫 发表于 2006-7-13 00:04

函数名: intr
功 能: 改变软中断接口
用 法: void intr(int intr_num, struct REGPACK *preg);
程序例:
#include
#include
#include
#include
#define CF 1 /* Carry flag */
int main(void)
{
char directory;
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
");
getcwd(directory, 80);
printf("The current directory is: %s
", directory);
return 0;
}

墙角野猫 发表于 2006-7-13 00:04

函数名: ioctl
功 能: 控制I/O设备
用 法: int ioctl(int handle, int cmd[,int *argdx, int argcx]);
程序例:
#include
#include
#include
int main(void)
{
int stat;
/* use func 8 to determine if the default drive is removable */
stat = ioctl(0, 8, 0, 0);
if (!stat)
printf("Drive %c is removable.
", getdisk() + &#39;A&#39;);
else
printf("Drive %c is not removable.
", getdisk() + &#39;A&#39;);
return 0;
}

墙角野猫 发表于 2006-7-13 00:05

函数名: isatty
功 能: 检查设备类型
用 法: int isatty(int handle);
程序例:
#include
#include
int main(void)
{
int handle;
handle = fileno(stdprn);
if (isatty(handle))
printf("Handle %d is a device type
", handle);
else
printf("Handle %d isn&#39;t a device type
", handle);
return 0;
}

墙角野猫 发表于 2006-7-13 00:05

函数名: itoa
功 能: 把一整数转换为字符串
用 法: char *itoa(int value, char *string, int radix);
程序例:
#include
#include
int main(void)
{
int number = 12345;
char string;
itoa(number, string, 10);
printf("integer = %d string = %s
", number, string);
return 0;
}
页: 5 6 7 8 9 10 11 12 13 14 [15] 16 17 18 19 20 21 22 23 24
查看完整版本: c语言函数大全