📄 fd.htm
字号:
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=gb_2312-80">
<meta name="Author" content="wdg">
<meta name="GENERATOR" content="Microsoft FrontPage Express 2.0">
<title>网上学堂 --> C语言编程宝典之一 -->函数名: d</title>
</head>
<body>
<div align="center"><center>
<table border="1" cellpadding="4" width="640"
bordercolordark="#FFFFFF" bordercolorlight="#FFFFFF">
<tr>
<td bgcolor="#FFE6B0" bordercolor="#8080FF" class="p9"><font
color="#BB0000">导航条:--></font> <a
href="../../index.html">网上学堂</a> --> <a
href="../tcindex.htm"><font face="宋体">C</font>语言编程宝典之一</a>
-->函数名: d</td>
</tr>
<tr>
<td bordercolor="#8080FF" class="p9">函数名: delay <br>
功 能: 将程序的执行暂停一段时间(毫秒)
<br>
用 法: void delay(unsigned milliseconds); <br>
程序例: <br>
/* Emits a 440-Hz tone for 500 milliseconds */ <br>
#include <dos.h> <p>int main(void) <br>
{ <br>
sound(440); <br>
delay(500); <br>
nosound(); </p>
<p> return 0; <br>
} <br>
<br>
</p>
<p>函数名: delline <br>
功 能: 在文本窗口中删去一行 <br>
用 法: void delline(void); <br>
程序例: </p>
<p>#include <conio.h> </p>
<p>int main(void) <br>
{ <br>
clrscr(); <br>
cprintf("The function DELLINE deletes \
<br>
the line containing the\r\n"); <br>
cprintf("cursor and moves all lines \ <br>
below it one line up.\r\n"); <br>
cprintf("DELLINE operates within the \ <br>
currently active text\r\n"); <br>
cprintf("window. Press any key to
\ <br>
continue . . ."); <br>
gotoxy(1,2); /* Move the cursor to the
<br>
second line and first
column */ <br>
getch(); </p>
<p> delline(); <br>
getch(); </p>
<p> return 0; <br>
} <br>
</p>
<p>函数名: detectgraph <br>
功 能:
通过检测硬件确定图形驱动程序和模式 <br>
用 法: void far detectgraph(int far *graphdriver,
int far *graphmode); <br>
程序例: </p>
<p>#include <graphics.h> <br>
#include <stdlib.h> <br>
#include <stdio.h> <br>
#include <conio.h> </p>
<p>/* names of the various cards supported */ <br>
char *dname[] = { "requests detection", <br>
"a CGA", <br>
"an MCGA", <br>
"an EGA", <br>
"a 64K EGA", <br>
"a monochrome EGA", <br>
"an IBM 8514", <br>
"a Hercules monochrome", <br>
"an AT&T 6300 PC", <br>
"a VGA", <br>
"an IBM 3270 PC" <br>
}; </p>
<p>int main(void) <br>
{ <br>
/* returns detected hardware info. */ <br>
int gdriver, gmode, errorcode; </p>
<p> /* detect graphics hardware available */ <br>
detectgraph(&gdriver, &gmode); </p>
<p> /* read result of detectgraph call */ <br>
errorcode = graphresult(); <br>
if (errorcode != grOk) /* an error <br>
occurred
*/ <br>
{ <br>
printf("Graphics
error: %s\n", \ <br>
grapherrormsg(errorcode));
<br>
printf("Press any key
to halt:"); <br>
getch(); <br>
exit(1); /* terminate with
an error <br>
code */ <br>
} </p>
<p> /* display the information detected */ <br>
clrscr(); <br>
printf("You have %s video display \ <br>
card.\n", dname[gdriver]); <br>
printf("Press any key to halt:"); <br>
getch(); <br>
return 0; <br>
} <br>
<br>
<br>
</p>
<p>函数名: difftime <br>
功 能: 计算两个时刻之间的时间差 <br>
用 法: double difftime(time_t time2, time_t
time1); <br>
程序例: </p>
<p>#include <time.h> <br>
#include <stdio.h> <br>
#include <dos.h> <br>
#include <conio.h> </p>
<p>int main(void) <br>
{ <br>
time_t first, second; </p>
<p> clrscr(); <br>
first = time(NULL); /* Gets system <br>
time */ <br>
delay(2000);
/* Waits 2 secs */ <br>
second = time(NULL); /* Gets system time <br>
again */ </p>
<p> printf("The difference is: %f \ <br>
seconds\n",difftime(second,first)); <br>
getch(); </p>
<p> return 0; <br>
} <br>
<br>
</p>
<p>函数名: disable <br>
功 能: 屏蔽中断 <br>
用 法: void disable(void); <br>
程序例: </p>
<p>/***NOTE: This is an interrupt service <br>
routine. You cannot compile this program <br>
with Test Stack Overflow turned on and <br>
get an executable file that operates <br>
correctly. */ </p>
<p>#include <stdio.h> <br>
#include <dos.h> <br>
#include <conio.h> </p>
<p>#define INTR 0X1C /* The clock tick <br>
interrupt */ </p>
<p>void interrupt ( *oldhandler)(void); </p>
<p>int count=0; </p>
<p>void interrupt handler(void) <br>
{ <br>
/* disable interrupts during the handling of <br>
the interrupt */ <br>
disable(); <br>
/* increase the global counter */ <br>
count++; <br>
/* reenable interrupts at the end of the <br>
handler */ <br>
enable(); <br>
/* call the old routine */ <br>
oldhandler(); <br>
} </p>
<p>int main(void) <br>
{ <br>
/* save the old interrupt vector */ <br>
oldhandler = getvect(INTR); </p>
<p>/* install the new interrupt handler */ <br>
setvect(INTR, handler); </p>
<p>/* loop until the counter exceeds 20 */ <br>
while (count < 20) <br>
printf("count is
%d\n",count); </p>
<p>/* reset the old interrupt handler */ <br>
setvect(INTR, oldhandler); </p>
<p> return 0; <br>
} </p>
<p>函数名: div <br>
功 能: 将两个整数相除, 返回商和余数 <br>
用 法: div_t (int number, int denom); <br>
程序例: </p>
<p>#include <stdlib.h> <br>
#include <stdio.h> </p>
<p>div_t x; </p>
<p>int main(void) <br>
{ <br>
x = div(10,3); <br>
printf("10 div 3 = %d remainder
%d\n", x.quot, x.rem); </p>
<p> return 0; <br>
} <br>
<br>
</p>
<p>函数名: dosexterr <br>
功 能: 获取扩展DOS错误信息 <br>
用 法: int dosexterr(struct DOSERR *dblkp); <br>
程序例: </p>
<p>#include <stdio.h> <br>
#include <dos.h> </p>
<p>int main(void) <br>
{ <br>
FILE *fp; <br>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -