Hi!
Although you're not the original poster, I'd be happy to explain. ^^
So, first of all, let's assume you have two files you want to compare like these ones:
Now, the first attempt would just compare "are the files identical?" which will of course give you "no" (or "false") as an answer. The way to do this would be to read the two files at the same time and compare if you're reading the same in both files.
The second attempt would give you an output something like
Which means "compared to the first file, the second file had the line 'my first' removed and had the line 'my second' inserted." This kind of comparison is much more complex, as if you were to change file2.txt to
- This is
-
my second
-
absolutely brilliant
-
file
the output would be something like
- < my first
-
> my second
-
> absolutely brilliant
so it can even recognise that line 3 in file1.txt and line 4 in file2.txt are the same. Now to do something like that, you'll probably have to read in one of the files line by line, save them to some kind of container and then read the other file line by line and check, if the line you just read was already in the first file. So, much more complicated.
Greetings,
Nepomuk