So I need to create a spell checker that takes an input file and checks it with a given dictionary file, and outputs the misspelled words. I have an idea of how to do it, but I get stuck where I need to compare the words in each file. I do not know how to compare one word of one file to all of the words in the other file. I was thinking I would use the strstr()
function to do it, but again I'm stuck on how to actually implement it. Here is my code so far:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int main(int argc, char* argv[]) {
FILE *inp = NULL;
FILE *dic = NULL;
inp = fopen(argv[1], "r");
dic = fopen("american", "r");
char *wordsString;
char *dictionary;
int inputStatus1, inputStatus2, i;
inputStatus1 = fscanf(inp, %s, wordsString);
inputStatus2 = fscanf(dic, %s, dictionary);
}