title: Censor words in c
body: <p>I've been working on a function which censors words. I've created this function and it works, except that it only accepts one argument. For example, when I do "./a.out test &lt; example.txt", it replaces "test" with CENSORED in "example.txt". But when I add another one, like "./a.out test test2 &lt; example.txt", it only replaces "test", not both "test" and "test2". </p>
  
  <p>Can someone help me with my function please? I don't know what I'm doing wrong.</p>
  
  <p>Here's the function:</p>
  
  <pre><code>#include &lt;assert.h&gt;
  #include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;string.h&gt;
  
  int main(int argc, char **argv)
   {
  assert(argc &gt; 1);
  char fileRead[4096];  
  char replace[] = "CENSORED"; 
  size_t word_len = strlen(argv[1]);
  
  while (fgets(fileRead, sizeof(fileRead), stdin) != 0)
  {
      char *start = fileRead;
      char *word_at;
      while ((word_at = strstr(start, argv[1])) != 0)
      {
          printf("%.*s%s", (int)(word_at - start), start, replace);
          start = word_at + word_len;
      }
      printf("%s", start);
  }
      printf("\n");
  
  return (0);
  }
  </code></pre>