I want my program to do something when it finds the end of a file (EOF) at the end of the last line of text, and something else when the EOF is at the empty line AFTER that
You'll have to use read rather than readLine and handle end-of-line detection yourself. readLine considers \n, \r, and EOF all to be line terminators, and doesn't include the terminator in what it returns, so you can't differentiate on the basis of the returned string.