📄 fk.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语言编程宝典之一 -->函数名: k</title>
</head>
<body>
<p> </p>
<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>
-->函数名: k</td>
</tr>
<tr>
<td bordercolor="#8080FF" class="p9">函数名: kbhit <br>
功 能: 检查当前按下的键 <br>
用 法: int kbhit(void); <br>
程序例: <p>#include <conio.h> </p>
<p>int main(void) <br>
{ <br>
cprintf("Press any key to
continue:"); <br>
while (!kbhit()) /* do nothing */ ; <br>
cprintf("\r\nA key was
pressed...\r\n"); <br>
return 0; <br>
} <br>
<br>
<br>
</p>
<p>函数名: keep <br>
功 能: 退出并继续驻留 <br>
用 法: void keep(int status, int size); <br>
程序例: </p>
<p>/***NOTE: <br>
This is an interrupt service routine.
You <br>
can NOT compile this program with Test <br>
Stack Overflow turned on and get an <br>
executable file which will operate <br>
correctly. Due to the nature of this <br>
function the formula used to compute <br>
the number of paragraphs may not <br>
necessarily work in all cases. Use
with <br>
care! Terminate Stay Resident (TSR) <br>
programs are complex and no other support <br>
for them is provided. Refer to the <br>
MS-DOS technical documentation <br>
for more information. */ <br>
#include <dos.h> <br>
/* The clock tick interrupt */ <br>
#define INTR 0x1C <br>
/* Screen attribute (blue on grey) */ <br>
#define ATTR 0x7900 </p>
<p>/* reduce heaplength and stacklength <br>
to make a smaller program in memory */ <br>
extern unsigned _heaplen = 1024; <br>
extern unsigned _stklen = 512; </p>
<p>void interrupt ( *oldhandler)(void); </p>
<p>void interrupt handler(void) <br>
{ <br>
unsigned int (far *screen)[80]; <br>
static int count; </p>
<p>/* For a color screen the video memory <br>
is at B800:0000. For a monochrome <br>
system use B000:000 */ <br>
screen = MK_FP(0xB800,0); </p>
<p>/* increase the counter and keep it <br>
within 0 to 9 */ <br>
count++; <br>
count %= 10; </p>
<p>/* put the number on the screen */ <br>
screen[0][79] = count + '0' + ATTR; </p>
<p>/* call the old interrupt handler */ <br>
oldhandler(); <br>
} </p>
<p>int main(void) <br>
{ </p>
<p>/* get the address of the current clock <br>
tick interrupt */ <br>
oldhandler = getvect(INTR); </p>
<p>/* install the new interrupt handler */ <br>
setvect(INTR, handler); </p>
<p>/* _psp is the starting address of the <br>
program in memory. The top of the
stack <br>
is the end of the program. Using _SS
and <br>
_SP together we can get the end of the <br>
stack. You may want to allow a bit of <br>
saftey space to insure that enough room <br>
is being allocated ie: <br>
(_SS + ((_SP + safety space)/16) - _psp) <br>
*/ <br>
keep(0, (_SS + (_SP/16) - _psp)); <br>
return 0; <br>
} </p>
</td>
</tr>
</table>
</center></div><div align="center"><center>
<table border="0" cellspacing="1" width="640">
<tr>
<td class="p9" height="60"> <script>document.write("<p><a href=\"http://view.gznet.com/cgi-bin/rl_views.cgi?UID=10013421\" target=sxrl>");
document.write("<img src=\"http://refer.gznet.com/cgi-bin/rl_refer2.cgi?UID=10013421&refer="+escape(top.document.referrer)+"\" width=1 height=1 border=0 alt=\" \">");
document.write("</a>");
</script></td>
</tr>
</table>
</center></div>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -