LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   "stty: standard input: Inappropriate ioctl for device" when running program (https://www.linuxquestions.org/questions/programming-9/stty-standard-input-inappropriate-ioctl-for-device-when-running-program-4175605157/)

eldiener 05-03-2017 07:58 AM

"stty: standard input: Inappropriate ioctl for device" when running program
 
I am getting the message "stty: standard input: Inappropriate ioctl for device" when running a program. Does this mean that the program is not running from an interactive console ? The program is periodically attempting to read from standard input on one of its threads via kbhit() and getch().

NevemTeve 05-03-2017 09:35 AM

The standard input isn't a terminal. You can check this, if you know the PID:
Code:

ls -l /proc/pid/fd/0

eldiener 05-03-2017 05:07 PM

Quote:

Originally Posted by NevemTeve (Post 5705671)
The standard input isn't a terminal. You can check this, if you know the PID:
Code:

ls -l /proc/pid/fd/0

Are you saying the error message is occurring because the standard input is not a terminal and it needs to be a terminal if I am using kbhit() and getch() in the program ?

NevemTeve 05-03-2017 10:30 PM

Why would you use them if it weren't a terminal?
You can use 'isatty(0)' in your program to determine if stdin is a terminal or not.


All times are GMT -5. The time now is 08:12 AM.