CompareFiles
This program highlights four different modules that allow you to compare files or strings for changes. In each case I shell to another program to do the file or string comparison. Rather than re-create the comparison routines, I take advantage of a) the comparisons and presentation are already done and we dont care whether the user has the 32 or 64-bit versions of the programs installed.
You dont need all 4 modules. I included them in this sample program so that you could test each one and see which one you prefer. My personal preference is Notepad++, a free text editor available from here that comes in 32/64 bits for Windows.. Another option is ExamDiff, a freeware program available here. It has a Pro version that is not free but this utility uses the free version which is 32-bit.
Another option is WinMerge, a free utility in 32and 64-bit available here. Finally there is Microsoft Word, which is part of the paid Office suite or as a standalone product here. It is not free but is available in 32 and 64-bits. I think it has the ugliest file comparison features but it has the advantage that it can compare files that are not just text files.
I am guessing that OpenOffice and LibreOffice have file comparison routines similar to MS Word but I havent checked them out. Words routine is sufficiently ugly that I stopped there.
Compare Text on the Clipboard with a File
Use of Notepad++ has an added feature you may find useful. Normally you enter the 2 filenames and the procedure compares the files. However, if you leave one of the filenames blank the comparison will be made between the one file and whatever text is on the clipboard.
Compare Strings
Each of the modules contains a comparison routine for files and a comparison routine for strings. The utility only uses the CompareFiles routines but the CompareStrings routines are available for your use as well.
There are some differences in how the CompareStrings routines work.
When you use Notepad++ to compare 2 strings, no temporary files are made.
When using ExamDiff to compare strings, 2 temporary file are made in the TEMP folder.
When you use WinMerge to compare two strings, no temporary files are made.
When you use MS Word to compare 2 strings, one temporary file is created/used in the TEMP folder.
Sample
In the zip file are File1.txt and File2.txt that are deliberately different in a few areas. Below are the results of doing a comparison in each of the 4 external programs.
Notepad++:
![Name: NotepadPlusPlus.jpg
Views: 25
Size: 24.1 KB]()
WinMerge:
![Name: WinMerge.jpg
Views: 25
Size: 21.6 KB]()
ExamDiff:
![Name: ExamDiff.jpg
Views: 25
Size: 19.2 KB]()
MS Word:
![Name: MSWord.jpg
Views: 25
Size: 23.7 KB]()
This program highlights four different modules that allow you to compare files or strings for changes. In each case I shell to another program to do the file or string comparison. Rather than re-create the comparison routines, I take advantage of a) the comparisons and presentation are already done and we dont care whether the user has the 32 or 64-bit versions of the programs installed.
You dont need all 4 modules. I included them in this sample program so that you could test each one and see which one you prefer. My personal preference is Notepad++, a free text editor available from here that comes in 32/64 bits for Windows.. Another option is ExamDiff, a freeware program available here. It has a Pro version that is not free but this utility uses the free version which is 32-bit.
Another option is WinMerge, a free utility in 32and 64-bit available here. Finally there is Microsoft Word, which is part of the paid Office suite or as a standalone product here. It is not free but is available in 32 and 64-bits. I think it has the ugliest file comparison features but it has the advantage that it can compare files that are not just text files.
I am guessing that OpenOffice and LibreOffice have file comparison routines similar to MS Word but I havent checked them out. Words routine is sufficiently ugly that I stopped there.
Compare Text on the Clipboard with a File
Use of Notepad++ has an added feature you may find useful. Normally you enter the 2 filenames and the procedure compares the files. However, if you leave one of the filenames blank the comparison will be made between the one file and whatever text is on the clipboard.
Compare Strings
Each of the modules contains a comparison routine for files and a comparison routine for strings. The utility only uses the CompareFiles routines but the CompareStrings routines are available for your use as well.
There are some differences in how the CompareStrings routines work.
When you use Notepad++ to compare 2 strings, no temporary files are made.
When using ExamDiff to compare strings, 2 temporary file are made in the TEMP folder.
When you use WinMerge to compare two strings, no temporary files are made.
When you use MS Word to compare 2 strings, one temporary file is created/used in the TEMP folder.
Sample
In the zip file are File1.txt and File2.txt that are deliberately different in a few areas. Below are the results of doing a comparison in each of the 4 external programs.
Notepad++:
WinMerge:
ExamDiff:
MS Word: