title: Using fscanf to read an unknown number of commands
body: <p>I'm reading from a file descriptor (fp) to get my commands from a client to my TCP server. The current way to get the command looks something like this</p>
  
  <pre><code>char cmd[21];
  while ( fscanf( fp, "%s", cmd ) == 1 &amp;&amp; strcmp( cmd, "quit" ) != 0 ) {
      //do work
  }
  </code></pre>
  
  <p>My issue is that one of the commands can be "move" which is followed by two integers. I know that I can do something like</p>
  
  <pre><code>char cmd[21];
  int row = 0;
  int col = 0;
  fscanf( fp, "%s%d%d", cmd, &amp;row, &amp;col );
  </code></pre>
  
  <p>but I can't do that unless I know that the cmd is "move". Is there a way that I can get the command string, check for "move" and then get the integers?</p>