Well, on my first attempt I was using Netbeans to create an empty text file which i added 10 words in for testing, and then on the second attempt I used the word list generated on unix.. Same results...
Type: Posts; User: purplechirin
Well, on my first attempt I was using Netbeans to create an empty text file which i added 10 words in for testing, and then on the second attempt I used the word list generated on unix.. Same results...
While i do the printing in hex.. here are the codes:
Code that opens the 'valid word list':
FILE *dict;
dict = fopen(filename, "r");
Code that reads the word:
for (i=0; fgets(words[i],...
the double quote somewhat disappeared.. there's no extra " on the second line.
edit: i changed it a little, and instead of a double quote i put different symbols:
printf("!%s@, #%s$\n",...
ehh.. i tried that and it printed out "string1", "string1 (without the last double quote). where did it go?? is that the problem? :confused:
It is an assignment, but I'm not looking for the solution - i just need help with particular parts that I seem to have problems with. :)
About the design, I do have a sketch of the flowchart...
do you mind explaining how it's supposed to be done? i'm really lost at this. not typecasting is it?
Thanks, I'll try to get the array size problem fixed.
But back to my other question, why would printf("%s, %s\n", token, words[i]); output "string1, string1", but when I use strcmp(token,...
I declared the array as char words[i][j]; (i and j are arbitrary numbers for me to test files that contain only a few lines - here I put char words[10][10];)
I tried using sizeof(words), but it...
Umm, to specify the boundary for the for-loop.. The size of the 'dictionary', i.e, char word[][]. Initially I put for (i=0; i<strlen(words); i++) (same thing, only without the asterisk), but the...
Yup, I did, and the 'dictionary' array (i.e. words[]) prints out fine when i do a simple loop to print out all the elements..
Oh dear, I'm really sorry I tend to skip a lot of details when I post my question..
My actual part of the code that does (or is supposed to do) the string compare is:
/* this whole chunk...
Well, it really is a simple spell checker.. Read a text file containing 'dictionary' words, read another text file containing paragraphs of words, and print out if any of the words are not in the...
It works! Thanks for your help!! :D
Now it comes to another problem.. How do I remove the newline character (\n) from the words that was copied from fgets??
I have a function in my spell checker codes to load words from a text file and store them in an array of strings.. Problem is, I can't figure out how to correct it.
For instance, the 'dictionary'...