LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-03-2017, 07:58 AM   #1
eldiener
Member
 
Registered: Nov 2006
Distribution: Mepis, CentOS, OpenSuse
Posts: 106

Rep: Reputation: 17
"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().
 
Old 05-03-2017, 09:35 AM   #2
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,862
Blog Entries: 1

Rep: Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869
The standard input isn't a terminal. You can check this, if you know the PID:
Code:
ls -l /proc/pid/fd/0
 
1 members found this post helpful.
Old 05-03-2017, 05:07 PM   #3
eldiener
Member
 
Registered: Nov 2006
Distribution: Mepis, CentOS, OpenSuse
Posts: 106

Original Poster
Rep: Reputation: 17
Quote:
Originally Posted by NevemTeve View Post
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 ?
 
Old 05-03-2017, 10:30 PM   #4
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,862
Blog Entries: 1

Rep: Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869
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.
 
  


Reply

Tags
console, input, stty



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
cannot open port "default": Inappropriate ioctl for device hitsware Linux - Newbie 3 07-26-2012 08:47 AM
Weird Perl error with "Inappropriate ioctl for device" bnutting Programming 9 03-12-2012 07:25 AM
"Inappropriate ioctl for device" on loopback after rebuild mk27 Linux - Kernel 2 12-02-2009 06:11 PM
chat and "inappropriate ioctl for device" MattFunke Linux - Software 3 01-29-2007 10:25 PM
stty: standard input: Inappropriate ioctl for device fwalthard Linux - General 0 07-14-2003 02:55 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:32 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration