免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1332 | 回复: 4
打印 上一主题 下一主题

学习的一个小结论!TC实现! [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-01-23 21:23 |只看该作者 |倒序浏览
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <dos.h>
  4. #include <bios.h>
  5. #include <conio.h>

  6. #define KEY_ESC 0x11b
  7. #define TIMER 0x1c
  8. int Counter=0;
  9. void interrupt ( *oh)();
  10. void interrupt nh()
  11. {
  12. Counter++;
  13. oh();
  14. }
  15. void StartTimer(void interrupt (*IP)())
  16. {
  17. oh=getvect(TIMER);
  18. disable();
  19. setvect(TIMER,IP);
  20. enable();
  21. }
  22. void CloseTimer()
  23. {
  24. disable();
  25. setvect(TIMER,oh);
  26. enable();
  27. }

  28. void main(void)
  29. {
  30. int key,time1=0,time=0,h1=0,h2=0,m1=0,m2=0;
  31. StartTimer(nh);
  32. for (;;)
  33. {
  34. if (bioskey(1))
  35. {
  36. key=bioskey(0);
  37. if (key==KEY_ESC)
  38. {
  39. break;
  40. }
  41. }
  42. if (Counter>18)
  43. {
  44. Counter=0;
  45. time++;
  46. gotoxy(15,15);
  47. if(time==10)
  48. {time1++;
  49. time=0;
  50. } if(time1==6)
  51. {
  52. m2++;
  53. time1=0;
  54. }
  55. if(m2==10)
  56. {m1++;
  57. m2=0;
  58. }
  59. if(m1==6)
  60. {h2++;
  61. m1=0;
  62. }

  63. printf(give you the time:'%d%d:%d%d:%d%d\n',h1,h2,m1,m2,time1,time);

  64. if (time==11)
  65. {
  66. break;
  67. }
  68. }
  69. }
  70. CloseTimer();
  71. }
复制代码


不知道帖这里会不会出啥问题

[ 本帖最后由 ljjk 于 2006-1-23 21:24 编辑 ]

论坛徽章:
0
2 [报告]
发表于 2006-01-24 10:34 |只看该作者
晕 <dos.h> <bios.h>

论坛徽章:
0
3 [报告]
发表于 2006-01-24 12:25 |只看该作者
是滴!
是TC嘛!

论坛徽章:
0
4 [报告]
发表于 2006-01-24 16:35 |只看该作者

shit

我以为是linux下的traffic control的实现呢?

论坛徽章:
0
5 [报告]
发表于 2006-01-24 17:28 |只看该作者
tc在win上用的不错
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP