title: Input numbers from Stdin
body: <p>I was trying to create a AVLtree using stdin input in C, the format I was trying to in put is: (7,19) (5,16)  (9,13). The code I am using is</p>
  <pre><code>char str[1024];
       int key,value;
       while (fgets(str,256,stdin)!=NULL)//stop read files when reached end of the line
       {
          if(*str == &quot;\n&quot;)
          {
              break;
          }
          if(sscanf(str,&quot;(%d, %d)&quot;,&amp;key, &amp;value) == 2)// if the function can address both number
          {
              //InsertNode(AVLtree,key,value);
              printf(&quot;%d, %d\n&quot;, key,value);
          }
          else
          {
              printf(&quot;cannot get correct key &amp; Value&quot;);
              exit(1)
          }
  </code></pre>
  <p>Basically, I am saying that read input from stdin using &quot;fgets&quot; function, in <code>(%d, %d)</code> format. Once it reached the end of the line, then stop. But by using this code, it only allows me to type in those nodes one per line, instead of typing all of them and end with enter. Is there any way to fix this?</p>