title: Move the cursor in a C program
body: <p>I'd like to move the cursor forward and backwards in a C program. I'm reading the whole line in a loop, but i would like that if a cursor key gets pressed the cursor on the screen changes position, without blocking the loop. I tried <code>getwch()</code> but it blocks the caller until enter it's pressed. What i'm looking for is a behavior similar to bash prompt. I'm reading with a code similar to this:</p>
  
  <pre><code>while (TRUE) {
     printf("%s", PROMPT);
     fgets(input, 1024, stdin);
     do_something(input);
  }
  </code></pre>
  
  <p>I'm trying that the function above works like <code>readline(PROMPT)</code> on the <code>readline.h</code> library</p>