FCreadline now catches a CTRL-D and turns it into an "exit" command.
(int)len changed to *len
Thanks to Ross Whitfield for hint and Justin Wozniak for actual code