title: Alternative to gets?
body: <p>I used to use gets but then I heard that it got removed from c11 and that its overall very dangerous.
  So I did some searching and found out that you can use fgets() to do the same thing.</p>
  
  <p>The problems is that when I do use fgets() it seems to also copy the end of the line aswell, which ends up making an extra unwanted line.</p>
  
  <p>To show you what I mean:</p>
  
  <pre><code>//if I have 
  char key[30];
  fgets(key, sizeof(key), stdin);
  
  //now if ender for instance: Doggo and do:
  printf("The key is:%s|hozaah!\n", key);
  
  //I expect it to print:
  The key is:Doggo|hozaah!
  
  //Instead it prints:
  The key is:Doggo
  |hozaah!
  </code></pre>
  
  <p>Is there a way to get around this? Or is there another function I can use instead?</p>