title: Searching for specific words in a text file
body: <p>HI guys havent been able to find how to search for specific words in a text file anywhere, so here it goes, this is what I have now and just read and prints the entire text file.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  #include &lt;string.h&gt;
  
  #include &lt;stdlib.h&gt;
  
  int main ( void )
  {
  
  static const char filename[] = "chat.log";
  FILE *file = fopen ( filename, "r" );
  if ( file != NULL )
  { 
  char line [ 128 ]; /* or other suitable maximum line size */
  while ( fgets ( line, sizeof line, file ) != NULL ) /* read a line */
  {
  
  fputs ( line, stdout ); /* write the line */
  } 
  fclose ( file );
  }
  
  else
  {
  perror ( filename ); /* why didn't the file open? */
  }
  return 0;
  }
  </code></pre>
  
  <p>Thank you :D</p>