C search words in a String
<p>I hope someone can help me. I think it's an easy question,
I want to write a program that searches words in a file.</p>

<pre><code>char *such = "Ingo";
char *fund;
FILE *datei;
char text[100];

datei = fopen("names.txt", "r");

if (datei == NULL) {
    printf("Fehler\n");
}
else 
{
    fscanf(datei, "%100c", text);
    text[100] = '\0';
    //i think this dont work
    if (fgets(text, 100, datei) != NULL)
    {
        printf("%s \n", text);
    }   
}

return 0;
</code></pre>

<p>The file contains this:</p>

<pre><code>Ingo Test Test 123 Test Ingo Ingo
</code></pre>

<p>Now I want to search how often the name "Ingo" is in the file.</p>

<p>It is possible to search for more words, maybe "ingo" and "test" and count this?</p>