Handling timeouts with feof()