I have a file and I want to read this file using C program using file operations. Then i want to take parameters from that file. Lets say nalu_type=x. So whenever i detect the s
# include
# include
# include
void main()
{
int noc=0,l;
FILE *fp;
char *str2,ch;
char*str1;
clrscr();
printf("Enter the String to be matched\n");
gets(str1);
l=strlen(str1);
fp=fopen("A.C","r");
while(1)
{
ch=fgetc(fp);
if(ch==EOF)
break;
else if(ch==' ')
{
fgets(str2,l+1,fp);
if((strcmp(str1,str2))==NULL)
noc++;
}
}
printf("NO of occurence is: %d",noc);
getch();
}