title: How can I read a single line from stdin?
body: <p>I'm asking for the equivalent of <code>fgets()</code> in C.</p>
  
  <pre><code>let line = ...;
  println!("You entered: {}", line);
  </code></pre>
  
  <p>I've read <a href="https://stackoverflow.com/questions/13579266/how-to-read-user-input-in-rust">How to read user input in Rust?</a>, but it asks how to read multiple lines; I want only one line. </p>
  
  <p>I also read <a href="https://stackoverflow.com/questions/28528998/how-do-i-read-a-single-string-from-standard-input">How do I read a single String from standard input?</a>, but I'm not sure if it behaves like <code>fgets()</code> or <code>sscanf("%s",...)</code>.</p>