You're almost there. Instead of having your new if statement test when
line1 does not equal line2, you could set a boolean flag in your second
while loop. The flag is set to true if a match is found. Then you could
have your if statement test that flag.

You then just need to reset the flag to false before a new word is
searched for.

I also noticed that your code will only work if the input is in
alphabetical order. You need to reset reader2 to the start of the file
after each word is checked. This will also solve the problem you had
where the program stops when an incoreect word is found. (That was
happening because reader2 just gets to the end of your dictionary file
and then jumps out of the loop).

Relevant Pages

Re: Any raw data specs for the Apple IIgs BRAM?...original set of example data with the original assembly code and with ... the AppleScript, and they don't match. ... ' current value of the carry flag and then change the carry flag ... ' end of the loop...(comp.sys.apple2.programmer)

Re: Thread causes 99% CPU Usage... the magic word in threading is CreateEvent(), CreateMutex, ... do it on your own yes, but use Sleepeach loop.... make that flag global or accessible from other threads so that when you have ... use WaitForSingleObject() to wait for that thread to get out... ...(microsoft.public.vc.language)

Re: Signal-Unsafe Problem... About the sig_atomic_t flag issue, the problems for my program are that ... My program is also busy running other code. ... There's no need to run a busy loop for the flag alone. ... You can either process incoming data right away, ...(comp.os.linux.development.apps)

Re: Terminating a running Loop in GUI!... I am having a problem in GUI.... handles.Userdata.abort = false; % set the flag... getting the handles structure in the loop might not be ...(comp.soft-sys.matlab)