title: How to programmatically send the Enter key in C
body: <p>This is a C console/terminal program.</p>
  <p>I would like to let the user wait for the program to do some background work until either the background work finishes or the user clicks on the <code>&lt;Enter&gt;</code> key. I do that with a statement:</p>
  <pre><code>getchar();
  </code></pre>
  <p>and I have another thread doing the background work.
  When the thread is about to finish, I would like the thread to send programmatically the <code>&lt;Enter&gt;</code> key so that the control continues after the <code>getchar()</code> statement.</p>
  <p>How is this possible?</p>