title: fscanf for stdin not prompting for input
body: <p>Given below is a snippet from my code. I learned its better to use <code>fscanf</code> instead of <code>scanf</code>. But fscanf is not waiting for an input</p>
  
  <pre><code>switch (argc) {
              case 2: printf("\nEnter the subject code: ");
                  while(fgets(temp_op-&gt;subject, BUF_NOTES, stdin)==NULL);
              case 3: printf("\nEnter the topic: ");
                  while(fgets(temp_op-&gt;topic, BUF_TOPIC, stdin)==NULL);
              case 4: printf("\nEnter the Level: ");
                  flag = fscanf(stdin,"%d",&amp;temp_op-&gt;level);
              case 5: printf("\nEnter the Answer Key: ");
                  while(fgets(temp_op-&gt;key, BUF_KEY, stdin)==NULL);
              case 6: printf("\nEnter any additional notes(optional): ");
                  while(fgets(temp_op-&gt;notes, BUF_NOTES, stdin)==NULL);
                  break;
              default:printf("\nExcess Arguments");
          }
  </code></pre>
  
  <p>The problem is for <code>case 5</code>. fgets is not waiting for an input, but case 6 doing good.</p>
  
  <p>However, if I comment out the <code>case 4</code> line "flag =...", then the next fgets will prompt for input. Wierd. I wonder why is a previous fscanf affecting the latter fgets. My structure definition is:</p>
  
  <pre><code>typedef struct {
  int mode ;
  int level;
  char subject[BUF_SUBJECT], topic[BUF_TOPIC], notes[BUF_NOTES], key[BUF_KEY];
  } operation;
  </code></pre>
  
  <p>The full source is at <a href="http://pastebin.com/HVvGC3B7" rel="nofollow">http://pastebin.com/HVvGC3B7</a></p>
  
  <p>What could be wrong ?</p>