⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fk.htm

📁 c语言基本的应用便于初学者学习使用 简单易懂
💻 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>&nbsp; </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">导航条:--&gt;</font> <a
        href="../../index.html">网上学堂</a> --&gt; <a
        href="../tcindex.htm"><font face="宋体">C</font>语言编程宝典之一</a>
        --&gt;函数名: k</td>
    </tr>
    <tr>
        <td bordercolor="#8080FF" class="p9">函数名: kbhit <br>
        功&nbsp; 能: 检查当前按下的键 <br>
        用&nbsp; 法: int kbhit(void); <br>
        程序例: <p>#include &lt;conio.h&gt; </p>
        <p>int main(void) <br>
        { <br>
        &nbsp;&nbsp; cprintf(&quot;Press any key to
        continue:&quot;); <br>
        &nbsp;&nbsp; while (!kbhit()) /* do nothing */ ; <br>
        &nbsp;&nbsp; cprintf(&quot;\r\nA key was
        pressed...\r\n&quot;); <br>
        &nbsp;&nbsp; return 0; <br>
        } <br>
        &nbsp; <br>
        &nbsp; <br>
        &nbsp; </p>
        <p>函数名: keep <br>
        功&nbsp; 能: 退出并继续驻留 <br>
        用&nbsp; 法: void keep(int status, int size); <br>
        程序例: </p>
        <p>/***NOTE: <br>
        &nbsp;&nbsp; This is an interrupt service routine.&nbsp;
        You <br>
        &nbsp;&nbsp; can NOT compile this program with Test <br>
        &nbsp;&nbsp; Stack Overflow turned on and get an <br>
        &nbsp;&nbsp; executable file which will operate <br>
        &nbsp;&nbsp; correctly.&nbsp; Due to the nature of this <br>
        &nbsp;&nbsp; function the formula used to compute <br>
        &nbsp;&nbsp; the number of paragraphs may not <br>
        &nbsp;&nbsp; necessarily work in all cases.&nbsp; Use
        with <br>
        &nbsp;&nbsp; care!&nbsp; Terminate Stay Resident (TSR) <br>
        &nbsp;&nbsp; programs are complex and no other support <br>
        &nbsp;&nbsp; for them is provided.&nbsp; Refer to the <br>
        &nbsp;&nbsp; MS-DOS technical documentation <br>
        &nbsp;&nbsp; for more information.&nbsp; */ <br>
        #include &lt;dos.h&gt; <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&nbsp; = 512; </p>
        <p>void interrupt ( *oldhandler)(void); </p>
        <p>void interrupt handler(void) <br>
        { <br>
        &nbsp;&nbsp; unsigned int (far *screen)[80]; <br>
        &nbsp;&nbsp; static int count; </p>
        <p>/* For a color screen the video memory <br>
        &nbsp;&nbsp; is at B800:0000.&nbsp; For a monochrome <br>
        &nbsp;&nbsp; system use B000:000 */ <br>
        &nbsp;&nbsp; screen = MK_FP(0xB800,0); </p>
        <p>/* increase the counter and keep it <br>
        &nbsp;&nbsp; within 0 to 9 */ <br>
        &nbsp;&nbsp; count++; <br>
        &nbsp;&nbsp; count %= 10; </p>
        <p>/* put the number on the screen */ <br>
        &nbsp;&nbsp; screen[0][79] = count + '0' + ATTR; </p>
        <p>/* call the old interrupt handler */ <br>
        &nbsp;&nbsp; oldhandler(); <br>
        } </p>
        <p>int main(void) <br>
        { </p>
        <p>/* get the address of the current clock <br>
        &nbsp;&nbsp; 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>
        &nbsp;&nbsp; program in memory.&nbsp; The top of the
        stack <br>
        &nbsp;&nbsp; is the end of the program.&nbsp; Using _SS
        and <br>
        &nbsp;&nbsp; _SP together we can get the end of the <br>
        &nbsp;&nbsp; stack.&nbsp; You may want to allow a bit of <br>
        &nbsp;&nbsp; saftey space to insure that enough room <br>
        &nbsp;&nbsp; is being allocated ie: <br>
        &nbsp;&nbsp; (_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 + -