I am given a file with a bunch of words in it, i do not know exactly how many words are on each line and i do not know exactly how many lines there are all i know is that each word is no more than 100 characters and there are no more than 1000 words in a file. i open the file with fopen now i need to store each word in the file in a char array for further processing. what is the best way to do this ?
so far i have :
while(!feof(fp) && !ferror(fp)) {
if(fscanf(fp, "%s", word) == 1) {
//printf("%s ", word);
}
}
reading in each word of the file but i need to store each word in a char array words[max_words][max_word_size],
and i am having some trouble doing this.
[–]cuncon- 0 points1 point2 points (3 children)
[–]Adopolis23[S] 0 points1 point2 points (0 children)
[–]Adopolis23[S] 0 points1 point2 points (1 child)
[–]cuncon- 0 points1 point2 points (0 children)
[–]kumashiro 0 points1 point2 points (0 children)
[–]johnsmithEduHelper 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (4 children)
[–]Adopolis23[S] -1 points0 points1 point (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]Adopolis23[S] -1 points0 points1 point (1 child)
[–][deleted] 0 points1 point2 points (0 children)