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
}

Shouldn't your program have an int main() function, too?

:)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.