A bit out of date, I suppose :) but I came across this post because I was looking for help on the same problem: I have two files which I display side by side, and I have to mark the lines that don t match in red.
Mine is a little bit of a special case, though, because 1) order is not important, and 2) each line is guaranteed to occur only once (the text is a license file with definitions, line by line).
It turned out that the easiest way of doing it was just to make lists of the two files, ls1 and ls2, and do the following (in pseudocode):
i = 0;
while (i < ls1.count) {
n = ls2.find(ls1[i]);
if (n >= 0) {
// found match in ls2
ls1.Delete(i);
ls2.Delete(n);
} else
i++;
}
Explained, for each line is ls1, see if there is a corresponding line in ls2. If so, delete both. What you re left with is simply the differences, and you can easily mark up those lines in the original text.
Extremely easy, no libraries included. Just my two cents...