Discuss File Compare in the Programming Tools forum on Dev Articles. File Compare Programming Tools forum for discussing any topics that don't fit into the programming categories above. Find information on tools and utilities to increase any programmer's productivity.
Posts: 6
Time spent in forums: 19 m 54 sec
Reputation Power: 0
File Compare
Hi,
i want the best program to compare CPP files, i tried Araxis and Beyond Compare and ExamDiff, all compare good, BUT, the problem is that i want a program which compares the WHOLE file, then gives me the REAL differences, meaning ..., let's say there's a TEST1::TEST2 (int x) and the function is made, then there's another one in the other file but in a different part of the file with the same name and with a slightly different content, i want the program to tell me that there's a function with that name but with different content inside it, u know what i mean? i know it needs a "little" AI :P, but i think it can be made, VC++ actually reads classes and functions and sort them in a drop down menu, so y not a compare program?!
Posts: 29
Time spent in forums: 6 h 7 m 44 sec
Reputation Power: 0
Quote:
Originally Posted by os008
Hi,
i want the best program to compare CPP files, i tried Araxis and Beyond Compare and ExamDiff, all compare good, BUT, the problem is that i want a program which compares the WHOLE file, then gives me the REAL differences, meaning ..., let's say there's a TEST1::TEST2 (int x) and the function is made, then there's another one in the other file but in a different part of the file with the same name and with a slightly different content, i want the program to tell me that there's a function with that name but with different content inside it, u know what i mean? i know it needs a "little" AI :P, but i think it can be made, VC++ actually reads classes and functions and sort them in a drop down menu, so y not a compare program?!
thanks for the help in advance.
NOTE: i have Black Belt in real life btw
I haven't done a lot in C++ since I'm not very keen on the language, however I'm sure it's possible. There are a bunch of ways to get the differences between files i.e. the diff command on *nix systems or maybe the difflib module in Python.
Both I imagine work in a similar way: read the file and compare the lines. Returning the lines that differ in each.
What I would suggest is that you look at the source for one of these - diff is probably more useful since I believe it's written in C.
If you only need to grab function/class declaration then you should be able to scan the two files and build an array of all the functions & classes - this will take some string processing. You can then compare them?
More generally if you wanted to see if two files were different but didn't care about the differences you could get an MD5 checksum of the two .