title: How to check if input from stdin is null or newline
body: <p>I am learning c and have written this piece of code</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  #include &lt;unistd.h&gt;
  
  int main(int argc,char *argv[])
  {
      char message[100];
      FILE *secret=fopen(argv[1],"w");
      FILE *public=fopen(argv[2],"w");
      while(scanf("%99s\n",message)==1)
      {
          if (strcmp(message,"\n")) //this does not work as expected
              break;
          if(strstr(message,"secret"))
              fprintf(secret,"%s\n",message);
          else
              fprintf(public,"%s\n",message);
      }
      return 0;
  }
  </code></pre>
  
  <p>The program is expected to do this</p>
  
  <ol>
  <li>accept two arguments from command line, which are names of two files</li>
  <li>Create two files with pointers secret and public.</li>
  <li>Read input from stdin</li>
  <li>In a while loop
  
  <ol>
  <li>If input is empty(null or newline), exit loop.</li>
  <li>if input contains phrase "secret", put the line into secret file.</li>
  <li>else put it into public file.</li>
  </ol></li>
  </ol>
  
  <p>The problem is that the part of code to check if the input is empty is not working. The program does not exit on a empty input(i.e newline). What is the correct code?</p>
  
  <p>BTW I read <a href="https://stackoverflow.com/q/20299348/3395716">How to check if stdin is empty in C</a> but I did not understand anything.</p>