fscanf Segmentation fault - C
<p>I am getting a segmentation fault error while trying to use fscanf to read from a file into a string, any help would be greatly appreciated. </p>

<pre><code>int main()
{
    char temp[100];
    FILE *fp = fopen("test.txt", "r");

    if (fp == NULL)
    {
        printf("error");
    }

    memset(temp, 0, strlen(temp));

    while (fscanf(fp,"%s", temp)==1)
    {

    }

return 0;
}
</code></pre>