You've done a couple of weird things here:
Quote:
Originally Posted by chevyman2002
Code:
char *word1, *word2, *phrase[256], *rest;
/* while(fgets(phrase, 256, fp) != NULL) {
*word1 = strtok(phrase, ";");
*word2 = strtok(phrase, ";");
That's an array of 256 char pointers, which you probably want "phrase[256]" instead.
That's dereferencing the pointer (inappropriate), get rid of the asterisk.
After you submit the pointer to a string once to strtok, don't do it again until you want to use a different string -- use strtok(NULL,";"). Also, strtok destroys the string so you may have problems assigning pointers this way, and you definitely will get a truncated string the next time you use "phrase". So you at least need to use a copy of phrase and not phrase itself, using one for strtok and one for the final fscanf.