0

i want to make a text programe ,this program supposed to have a text mode and a command mode;
in text mode you can type and whit arrow key change your position
in command mode by typing your comman you can get the results for example:
by typing copy 2 3 5 the program will go to line 2 and then to character 3 and then counts 5 character and copies them in to anoter array (clipboard[][]),
a know that code bellow has lots of problems so i need your help
thank u,

void text(char txt[20][4]){
char ch;
clrscr();
gotoxy(45,0);
printf("text mode");
for(y=0;y<=4;)
{
for(i=0;i<=20;i++){
ch=getch();

if (ch==13||ch==0)
pos(ch);

putch(ch);
txt[i][y]=ch;
}//end of for
y=y+1;
}//end of outer for
}
//****************************
void pos(char ch){
if (ch==13){
 i=1;
 y=y+1;
 gotoxy(i,y);
 } 
else if(ch==0){

    ch=getch();
    if(ch==77){
       i=i+1;
       gotoxy(i,y);
       }
    else if(ch==72){
       y=y-1;
       gotoxy(i,y);
       }
    else if(ch==80){
       y=y+1;
       gotoxy(i,y);
       }
    else if(ch==75){
       i=i-1;
       gotoxy(i,y);
       }
       }// end of first else if
}
2
Contributors
1
Reply
2
Views
9 Years
Discussion Span
Last Post by Adak
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.