Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _CRT_SECURE_NO_WARNINGS
- #include <stdio.h>
- #include <string.h>
- #define MAX_WORD_LENGTH 50
- #define MAX_WORDS 100
- int main(void)
- {
- char word[MAX_WORD_LENGTH];
- char wordList[MAX_WORDS][MAX_WORD_LENGTH];
- int wordCount = 0;
- int i;
- int found=0;
- FILE *fp;
- fp=fopen("C:\\Users\\Kirsten\\Documents\\Visual Studio 2010\\Projects\\Lab 10\\Lab10Resources\\ex1\\words.txt","r");
- if (fp==NULL) {
- printf("file did not open");
- }
- fscanf(fp, "%s", word);
- printf("%s", word);
- //wordList[0][MAX_WORD_LENGTH]=word;
- //printf("%s", wordList[0][MAX_WORD_LENGTH]);
- //while (fscanf(fp, "%s", word)!= EOF) {
- /*while (found==0) {
- for (i=0;i<=wordCount;i++) {
- if (strcmp(word, wordList[i])==0) {
- found++;
- }
- }
- printf(word);
- printf("\n");
- }*/
- //}
- /*while (fscanf(fp, "%s", word) != EOF) {
- strcpy(wordList[0], word);
- for (i=0; i<=wordCount; i++) {
- if(strcmp(word, wordList[i]) != 0) {
- strcpy(wordList[i], word);
- wordCount++;*/
- fclose(fp);
- return 0;
- }
Add Comment
Please, Sign In to add comment