0

How to move cursor using keypress , without using goto in C?

Like I want to a program to move the cursor using keypress W , A , S , D (W for move up , A for move left , S for move down and D for move left)

leonardo
  • 9
  • 1
  • 1
    OS? Targeted terminal emulator (if any)? – genpfault May 20 '22 at 16:06
  • 2
    There's no "standard API". The "goto" keyword has nothing to do with cursor control. There are many platform-specific options (for example, Win32, if you happen to be running a command prompt in Windows). STRONG SUGGESTION: consider the open source, cross-platform [ncurses](https://tldp.org/HOWTO/NCURSES-Programming-HOWTO/) library. – paulsm4 May 20 '22 at 16:14

1 Answers1

0

goto doesn't help you here. In fact, the code for controlling a desktop computer's mouse is much more complicated.
Often it's not portable either.
For example: In Windows in Visual Studio, we can use functions from Microsoft's Win32API. This guy already gave an answer (the code is messy):
https://stackoverflow.com/a/2732323/7753444

Ronen
  • 195
  • 7