title: fgets produces the compiling error "ignoring return value of 'fgets', declared with attribute wan_unused_result"
body: <p>I compile my code with "gcc -O -Wall -Werror" and after seraching through the forums i tried to make the fgets function void as well.I initially tried without void. Nothing seems to work. The top line is the specific line of code that isn't working. </p>
  
  <pre><code>(void) fgets(diceString, 300, stdin);
  diceString[strlen(diceString) - 1] = '\0';
  </code></pre>
  
  <p>The solution of checking it with the following also didn't work as per the similar question.</p>
  
  <pre><code>if(fgets(diceString, 300, stdin) ){
  </code></pre>
  
  <p>I will also provide the context of the entire code below</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;math.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;string.h&gt;
  #include &lt;ctype.h&gt;
  
  #define INCORRECT_FORMAT    0
  #define OUT_OF_RANGE        1
  #define INC_NUM_VALUES      2
  
  #define TRUE                1
  #define FALSE               0
  
  int main(int argc, char *argv[]){
  
      char diceString[300] = {0};
      int diceNum[5] = {0};
      int errorType[3] = {0};
      int valueCounter = 0;
  
      (void) fgets(diceString, 300, stdin);
      diceString[strlen(diceString) - 1] = '\0';
  
  
      int i = 0;
      int j = 0;
      char ch = 0;
  
      while(diceString[i] != '\0'){
          if(diceString[i] &lt;= '6' &amp;&amp; diceString[i] &gt;= '1'){
              ch = diceString[i];
              diceNum[j] = ch - '0';
              j++;
              valueCounter++;
          }
          if(valueCounter &gt;5){
              errorType[INC_NUM_VALUES] = TRUE;
          }if( i &lt; 4  &amp;&amp; diceString[i+1] != ' '){
              errorType[INCORRECT_FORMAT] = TRUE;
          }if( i &gt; 0 &amp;&amp; diceString[i-1] != ' '){
              errorType[INCORRECT_FORMAT] = TRUE;
          }
  
          i++;
  
  
      }
  
      printf("The errors are :\n");
      i = 0;
      while(i &lt; 3){
          printf("%d", errorType[i]);
          i++;
      }
      i = 0;
      while(i&lt;5){
          printf("%d\n",diceNum[i]);
          i++;
      }
  
  
  
  
      return 0;
  }
  </code></pre>