When a terminal read cannot get any data from the buffer and must perform a system terminal read, all terminal output data not yet flushed to the system must be output. While writing the unflushed terminal output data, an error occurred.
The terminal input operation fails.
Change the code so all terminal output is completed and flushed to the terminal before the terminal input operation. Check all return codes to find out if any output operation gets an error; then check the errno value for further information regarding any errors encountered.
EDC4TE