title: What is the difference between halfdelay() and cbreak() + timeout() when getting input?
body: <p>I'm writing a typing game with ncurses in C++, and I noticed there are <code>cbreak()</code> and <code>halfdelay()</code> functions to switch modes for text input in ncurses.</p>
  <p>I know <code>cbreak()</code> is used to disable line buffering when reading characters, and the difference between <code>cbreak()</code> and <code>halfdelay()</code> is <code>halfdelay()</code> take a parameter to blocking for X tenths.</p>
  <p>And I was curious what if I use <code>cbreak()</code> with <code>timeout()</code>, does it works like <code>halfdelay()</code> ?</p>
  <p>I made an experiment to see their difference:</p>
  <p>Use <code>halfdelay()</code>:</p>
  <pre><code>#include &lt;ncurses.h&gt;
  int main()
  {
      initscr();
      halfdelay(10); // blocking for 1s
      getch();
      endwin();
  }
  </code></pre>
  <p>Use <code>cbreak()</code> and <code>timeout()</code>:</p>
  <pre><code>#include &lt;ncurses.h&gt;
  int main()
  {
      initscr();
      cbreak();
      timeout(1000); // blocking for 1s
      getch();
      endwin();
  }
  
  </code></pre>
  <p>I found both of behavior are waiting for a char and exit the programs immediately until exceed 1s, so I would like to ask if they have difference in ncurses?</p>