title: How to use read() to get input of unknown length from stdin
body: <p>Until now, whenever I wanted to get user input from <em>stdin</em> I used <code>scanf()</code> but this time I can't and <strong>have</strong> to use <code>read()</code>.</p>
  
  <p>Usually, to get input from <em>stdin</em> using <code>read</code> I use:  </p>
  
  <pre><code>char buf[128];
  read(0, buf, sizeof(buf));
  </code></pre>
  
  <p>But this time I don't have any length limit to the input and I want to allow input with arbitrary size. In the past I used <code>scanf</code> for this, like so:  </p>
  
  <pre><code>char *user_input;   
  scanf("%ms", &amp;user_input);
  </code></pre>
  
  <p>How can I do this with <code>read()</code>?<br>
  <em>Note: safety isn't important here</em></p>