| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 305 人关注过本帖
标题:关于一个system函数的应用问题
只看楼主 加入收藏
镖叔
Rank: 1
等 级:新手上路
帖 子:16
专家分:0
注 册:2012-10-4
结帖率:75%
收藏
 问题点数:0 回复次数:0 
关于一个system函数的应用问题
#include <stdio.h>
#include <stdlib.h>
#include <dos.h>
#include <conio.h>
int key();
upbar(int y);
downbar(int y);
#define KEY_DOWN 80
#define KEY_DOWN 80
#define KEY_UP 72
#define KEY_A 30
#define KEY_B 48
#define KEY_C 46
#define KEY_Q 18
#define KEY_ENTER 28
void main ()
{
  int y;
  int ky;
  char ch;
  textmode(C80);  
  textbackground(13);
  textcolor(RED);
   window(7,8,19,15);
  textbackground(1);
 textcolor(RED);
window(8,9,18,14);
gotoxy (3,3);
cprintf("Q:quit\r\n");
gotoxy (3,4);
cprintf("A:dir\p\r\n");
gotoxy (3,5);
cprintf("C:dir\p\r\n");
do
{ky=key();
 switch(ky)
 {
     case KEY_A:
     {y=12;
      ky=KEY_ENTER; };
    break;
    case KEY_B:
 {ky=KEY_ENTER;
     y=13;};
 break;
 case KEY_C:
 {y=14;
     ky=KEY_ENTER;};
 break;
 case KEY_Q:
 {y=11;
     ky=KEY_ENTER;};
 break;
 case KEY_DOWN:
 if(y<13)
 {downbar(y);
     y++;};
 break;
 case KEY_UP:
 if(y>10)
 {upbar(y);
     y--;};
 break;}
}while(ky!=KEY_ENTER);
switch(y)
{
    case 11:
    ch='%';
    break;
    case 12:
{system("dir");
    getch();};
break;
    case 13:
{system("dir/p");
    getch();};break;
    case 14:
{system("dir/w");
    getch();};break;
}}
int key()
{
    union REGS rg;
    rg.h.ah=0;
    int86(0x16,&rg,&rg);
    return rg.h.ah;}
upbar(int y)
{
    int i;
    typedef struct text1_struct
{
    unsigned char ch;
    unsigned char attr;}text1;

text1 t;
for(i=9;i<=17;i++)
{
    gettext(i,y,i,y,&t);
    t.attr=0x1f;
    puttext(i,y,i,y,&t);
    gettext(i,y+1,i,y+1,&t);
    t.attr=0x4f;
    puttext(i,y+1,i,y+1,&t);}
gotoxy(3,y+1);
return;}
downbar(int y)
{
    int i;
    typedef struct text1_struct
{
    unsigned char ch;
    unsigned char attr;}text1;

text1 t;
for(i=9;i<=17;i++)
{
    gettext(i,y,i,y,&t);
    t.attr=0x1f;
    puttext(i,y,i,y,&t);
    gettext(i,y-1,i,y-1,&t);
    t.attr=0x4f;
    puttext(i,y-1,i,y-1,&t);}
gotoxy(3,y+1);
return;}
其中的switch(y)
{
    case 11:
    ch='%';
    break;
    case 12:
{system("dir");
    getch();};
break;
    case 13:
{system("dir/p");
    getch();};break;
    case 14:
{system("dir/w");
    getch();};break;
}}

的system函数为什么这样用的呢,
搜索更多相关主题的帖子: 应用 window system include 
2012-11-03 09:45
快速回复:关于一个system函数的应用问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017054 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved