#include <stdio.h> #include <ctype.h> #include <stdlib.h> #include <string.h> int main(){ FILE *fptr,*ptr; int l,i=0,count=0,total=0; char name[50],n,word[25],k; printf("\nEnter the file name:"); scanf("%s",name); printf("\nEnter the word to be found:"); fgets(word,25,stdin); l=strlen(word); fptr=fopen(name,"r"); if(fptr==NULL){ printf("\nProblem with opening the file"); exit(1); } n=fgetc(fptr); while(!(feof(fptr))){ if(n==toupper(word[i])||n==tolower(word[i])){ count++; if(count==1){ ptr=fptr; } i++; } else if(n!=word[i]){ if(count>1){ fptr=ptr; } count=0; i=0; } if(count==l){ total++; count=0; i=0; } n=fgetc(fptr); } }
struct
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)