Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

i need to compare two files, the fi

Status
Not open for further replies.

niru1972

Programmer
Feb 3, 2001
6
US
i need to compare two files, the first file is a kind of dictionary with all the words and the second file is having some data in it. i need to compare the words in file2 with that in file1 , if the word of file2 exists in file1 then i have to print the word, and the offset of the word in the file.

how do i compare the two files.
 
Well, what you need to do is determine the sperator for the words in file 1.

1. Read the first word in file 2
2. Look at the first word in file 1
3. Compare, if they're ==, print the word
4. if not, move to the next word in file 1
5. Compare...
As always, I hope that helped!

Disclaimer:
Beware: Studies have shown that research causes cancer in lab rats.
 
Mbaranski, I just wounder how they get the lab rats to do researches, -:) Walid Magd
Engwam@Hotmail.com
 
how do i compare the words in the file, do i have to read the characters using getc till i get a space and put them in an array and then compare it with the next file
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top