title: Comparing 2 substrings in C
body: <p>I having trouble reading a string of characters from a file and then comparing them for the first part of my homework on ubuntu using C.
  So the program compiles fine but it seems I get stuck in an infinite loop when it gets to the while loop under the compare string portion of the code. Thanks.</p>
  
  <p>Also, can I get some advice on how to take multiple inputs from the terminal to compare the string from the 'bar' file and the string of x substring of characters after that in the terminal. My output should look like:</p>
  
  <pre><code>% echo "aaab" &gt; bar
  % ./p05 bar aa B
  2
  1
  %
  </code></pre>
  
  <p>This is what I have so far:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  #include &lt;stdlib.h&gt;
  
  int main(void /*int argc, char *argv[]*/) 
  {
  
    /******* Open, Read, Close file**********/
    FILE *ReadFile;
  
    ReadFile = fopen(/*argv[1]*/"bar", "r");
  
    if(NULL == ReadFile)
      {
        printf("\n file did not open \n");
        return 1;
      }
  
    fseek(ReadFile, 0 , SEEK_END);  
    int size = ftell(ReadFile); 
    rewind(ReadFile);                
  
    char *content = calloc( size +1, 1); 
  
    fread(content,1,size,ReadFile);     
  
    /*fclose(ReadFile); */                 
  
    printf("you made it past opening and reading file\n");
    printf("your file size is %i\n",size);
  
    /*********************************/
  
  
    /******String compare and print*****/
    int count =0;
    const char *tmp = "Helololll";
    while (content = strstr(content,"a"))
      {
        count++;
        tmp++;
    }
    printf("Your count is:%i\n",count);
  
    /***********************************/
      return 0;
  }
  </code></pre>