|
Turbo C 2.0、Borland C++库函数及用例(18) the interrupt */ disable(); /* increase the global counter */ count++;/* reenable interrupts at the end of the handler */ enable(); /* call the old routine */ oldhandler(); }int main(void) { /* save the old interrupt vector */ oldhandler = getvect(INTR);/* install the new interrupt handler */ setvect(INTR, handler);/* loop until the counter exceeds 20 */ while (count < 20) printf("count is %d\n",count);/* reset the old interrupt handler */ setvect(INTR, oldhandler); return 0; } 函数名: div 功 能: 将两个整数相除, 返回商和余数 用 法: div_t (int number, int denom); 程序例: #include <stdlib.h> #include <stdio.h> div_t x;int main(void) { x = div(10,3); printf("10 div 3 = %d remainder %d\n", x.quot, x.rem); return 0; } 函数名: dosexterr 功 能: 获取扩展DOS错误信息 用 法: int dosexterr(struct DOSERR *dblkp); 程序例:#include <stdio.h> #include <dos.h>int main(void) { FILE *fp; struct DOSERROR info; fp = fopen("perror.dat","r"); if (!fp) perror("Unable to open file for reading"); dosexterr(&info); printf("Extended DOS error \ information:\n"); printf(" Extended error: \ %d\n",info.exterror); printf(" Class: \ %x\n",info.class); printf(" Action: \ %x\n",info.action); printf(" Error Locus: \ %x\n",info.locus); return 0; } 函数名: dostoUnix 功 能: 转换日期和时间为UNIX时间格式 用 法: long dostounix( struct date *dateptr, struct time *timeptr ); 程序例: #include <time.h> #include <stddef.h> #include <dos.h> #include <stdio.h> int main(void) { time_t t; struct time d_time; struct date d_date; struct tm *local; getdate(&d_date); gettime(&d_time); t = dostounix(&d_date, &d_time); local = localtime(&t); printf("Time and Date: %s\n", asctime(local)); return 0; } 函数名: drawpoly 功 能: 画多边形
|