Match
Match
h>
#include <string.h>
#include "filer.h"
#include <ctype.h>
#include <stdlib.h>
word[i] ='\0';
char c;
int position=0;
while((c=fgetc(f))!=EOF)
{
//cleaning up the buffer from garbage
for(int o=0; o<48 ; o++)
buffer[o] = '\0';
//building words
for(c,i=0; c!=' ' && c!='\n' &&c!=',' && c!= ';'; c=fgetc(f),i++)
{
if(i==0)
position = ftell(f);
if(i <47)
buffer[i] = c;
else
break;
}
//convert them to lower if they are upper
for(int k=0; k<strlen(buffer); k++)
{
if(isupper(buffer[k]))
buffer[k] = tolower(buffer[k]);
}
if(strlen(buffer)>0)
printf("%s,%s\n ",buffer,word);
//compare them
if(strcmp(word,buffer)==0)
{
count++;
match[count] = position;
return match;
}