title: How to input an int or char from the terminal without having to press "enter" on both Windows and Unix
body: <p>Basically I want to input a pass code composed of 4 digits from the terminal.  I have some sloppy solutions but I want something clean.  I want the user to write a digit and I'll put it in an array without having to press "enter".  And then the user will give the second digit and I'll put it in the array... So for example it will give some thing like this:</p>
  
  <pre><code>&gt;1      the array [1, 0, 0, 0]
  &gt;12     the array [1, 2, 0, 0]
  &gt;123    the array [1, 2, 3, 0]
  &gt;1234   the array [1, 2, 3, 4]
  &gt;the rest of the program
  </code></pre>