Need "File Compare Algorithm" help
I'm racking my brain trying to think of a simple yet efficient way to do the following... I have two files to compare, a C file and a T file. The C file is an ASCII file and the T file is a binary file. Both contain "n" amount of "System" elements and each system can contain "n" "Node" elements, kind of like a tree structure. The C file is handed to me and is used as the basis for constructing a T file. A System & a Node can only be added to a T file if it's in the C file and can only be deleted from a T file if it's no longer in the C file. With me so far? So I need to compare these two files and I'm trying to figure out how. Here's what I have so far...
1) Read in the C file, store the Systems & Nodes in a vector and do the same for the T file. Compare the vectors and make additions & deletions based on this... seems like the additons & deletions wil be LOTS of overhead...
2) Write a bool function to search for Systems & Nodes in a T file based on what's in the C file. Make additions & deletions based on this...
3) Parse the T file and for every System & Node I find, parse the C file to see if it exists...almost like in #2 above but use the T file to search in the C file...
None of these seem like a "great" idea but I've never compared two files so I'm trying to not make more work for myself nor screw it up! Any ideas....?
Thanks for reading my post...! :)