中断程序

tiaraxin 2002-01-24 03:43:11
谁会用C语言编中断程序:一个死循环,
当按下一个键(比如abcd...)就退出循环。
是中断方式,不是程序查询方式。
(不要用汇编)
...全文
207 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
dynamic_pump 2002-01-29
  • 打赏
  • 举报
回复
要捕捉键盘按键,很复杂,建议多看看dos下编程书。
tiaraxin 2002-01-29
  • 打赏
  • 举报
回复
不好意思,我是说按一特定的键如"a",若是按"b"的话则不响应中断。如何用这个函数做到?
  • 打赏
  • 举报
回复
好!
SCUM 2002-01-26
  • 打赏
  • 举报
回复
在 http://expert.csdn.net/Expert/topic/499/499524.shtm 我有回答
talcon_hu 2002-01-26
  • 打赏
  • 举报
回复
不对!!!!!!!!!!!!!!!!!!!!
yz9822 2002-01-26
  • 打赏
  • 举报
回复
看看这个!

#include <dos.h>
#include <stdio.h>

void interrupt (*oldfunc)();
void interrupt get_out();

int looping=1;

int main(void)
{
puts("Press <Shift><Prt Sc> to terminate");
//save the old interrupt
oldfunc=getvect(5);
//install interrupt handler
setvect(5,get_out);
//do nothing
while(looping);
//restore to original interrupt routine
setvect(5,oldfunc);
puts("Success");
return 0;
}

void interrupt get_out()
{
looping=0; //change global variable to get out of loop
}

Nizvoo 2002-01-26
  • 打赏
  • 举报
回复
也来学习。
tiaraxin 2002-01-25
  • 打赏
  • 举报
回复
这个函数我也知道,可不清楚具体怎么用。请指点迷经。

70,037

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧