Hello. For one of my classes, I have to write a program that reads in a file that contains a string and looks for occurrences of substrings asked by the user. I am running this on Ubuntu by the way.

Anyway, the terminal commands are

echo "abcdefgh" > bar
./file bar bc

where file is the name of my program, bar is the file that "abcdefgh" is saved to, and bc is the string the user wants to find. The code for my program is below

Code:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>


int main(int argc, char *argv[])
{
    FILE *pFile;
    char *textFile=NULL;
    textFile=(char *)malloc(sizeof(char)*10);
    pFile=fopen(argv[1],"r");
    
    int count;
    
    while(fgets(textFile,sizeof(textFile)-1,pFile)!=NULL)
    {


    if(argc>1)
    {
    for(count=1;((textFile=strstr(textFile,argv[count]))!=NULL);count++)
    {
    textFile++;
    }//end for
    }//end if
    }//end while
            
printf("The string appeared: %d times\n",count);


fclose(pFile);


free(textFile);


return 0;


}//end main
I am receiving the Segmentation Fault error but have no idea where the problem is or how to fix it. If someone could tell me, that would be great.