Can anyone tell how to move cursor using keyboard in turboc editor | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can anyone tell how to move cursor using keyboard in turboc editor

17th Dec 2017, 3:44 PM
Keerthana Vema
Keerthana Vema - avatar
3 Answers
+ 4
You can't read the Up key, Down key, etc in the Turbo C terminal as they are virtual keys. But you may read 'w', 'a', 's' and 'd' for the same, and can try this : while(true) { char c = getch(); if(c=='w') gotoxy(wherex(),wherey()-1); if(c=='a') gotoxy(wherex()-1,wherey()); if(c=='s') gotoxy(wherex(),wherey()+1); if(c=='d') gotoxy(wherex()+1,wherey()); }
17th Dec 2017, 4:10 PM
Kinshuk Vasisht
Kinshuk Vasisht - avatar
+ 2
The print cursor? You can't control it from the keyboard, as Turbo C cannot read Virtual Keys in its terminal. You may control it in the program using gotoxy(x,y); defined in conio.h
17th Dec 2017, 3:51 PM
Kinshuk Vasisht
Kinshuk Vasisht - avatar
+ 2
@Kinshuk Vasisht tq for answer but I want to control from keyboard...but gotoxy places it to some position which we specified.
17th Dec 2017, 3:53 PM
Keerthana Vema
Keerthana Vema - avatar