title: How to create a command line in C?
body: <p>I'm trying to create a command line for an app in C.  </p>
  
  <pre><code>int main(int argc, char const *argv[])
  {
    char cmd[40];
  
    do {
      scanf("%[^\n]", cmd);
  
      if(strcmp(cmd, "start"))
        new_game();
    } while(strcmp(cmd, "exit"));
    return 0;
  }
  </code></pre>
  
  <p>I can't use the "%s" because the command might have more than one argument so I need to use the exception and ignore the new line char. The problem is that the program won't call the scanf anymore after one insertion. Why is this happening?</p>
  
  <p>Thank You</p>