Created
November 5, 2018 18:02
-
-
Save sojohnnysaid/49f6f80bcab1762295e4c233aef7e094 to your computer and use it in GitHub Desktop.
load() test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bool load(const char* dictionary) // passing in the file name of the dictionary | |
{ | |
// create a FILE pointer and fopen() to start the stream | |
FILE * dictionary_stream = fopen(dictionary, "r"); | |
// a place to store the current word in the loop | |
char temp[LENGTH+1] = {'\0'}; | |
// the condition in this while loop is also storing | |
// the string as well so...a slick way of doing | |
// two jobs in one place! | |
// counter for our test | |
int counter = 0; | |
while (fscanf(dictionary_stream, "%s", temp) == 1){ | |
counter++; | |
} | |
printf("%d\n", counter); // dictionaries/large has about 143091 words | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment