I'm trying to scan a list of words into an array based on some input from a text file. The first number indicates the amount of words in the text file. The longest word will be 29 characters (I'm still not sure how to do this). The dictWord is to store the words, but I don't know how to set the number in the array to the first number in the text file, and set the maximum length of the word to 29 characters.
When I run this and attempt to print out the fourth word in the array to test if it's working, the program prints out this:
instead of words. Can anyone give advice as to why?
fscanf(fin, "%d", &numWords);
for(i = 0; i < numWords; i++)
fscanf(fin, "%s", dictWord[i]);
The format of the textmsg.txt file is as follows: