Ok I figured out I need to use "inFile.getline(line,length)" instead of "getline(inFile, line)". I created a struct like stated early. However I'm having trouble storing the words from the text file.
I use this function-
void displayFile (char fileName[], words array[] )
{
int i = 0;
ifstream inFile;
char line [101];
inFile.open(fileName);
while (inFile.getline(line,101))
{
cout << line << endl;
array[i].word = line;
i++;
}
inFile.close();
}
Where array, is an array of structs made up of character array"word" and an integer "count". Any help on storing the words and the number of words in the array would be helpfull.