#include #include #include int main(void) { FILE *file; char text[10000], *word = "vie privée", *found; int n = 0; file = fopen("cypherpunk.txt", "r"); if (file == NULL) { printf("failed reading file"); return EXIT_FAILURE; } while (fgets(text, sizeof(text), file) != NULL) { found = strstr(text, word); while (found != NULL) { printf("found at position %ld\n", (long)(found - text) + 1); n++; found = strstr(found + 1, word); } } printf("%d", n); fclose(file); return EXIT_SUCCESS; }