LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices



Reply
 
Search this Thread
Old 08-02-2003, 04:11 AM   #1
yanming
LQ Newbie
 
Registered: Aug 2003
Location: US
Distribution: RedFlag
Posts: 2

Rep: Reputation: 0
How to get keyboard input from C in Linux


I am develop a "counsol application" (command line environment).
I want to know how to get keyboard input from a C program.
(this means the user interactes with the program by typing into
the command line.)

This program is related to creating teaching material for high
school programing class. I want to avoid using advanced GUI IDE.
I plan to use the open source IDE Rhide. or just use gcc.
 
Old 08-02-2003, 04:36 AM   #2
arunshivanandan
Member
 
Registered: May 2003
Location: Kerala,India
Distribution: RedHat,Mandrake,Debian
Posts: 643

Rep: Reputation: 30
Well,if u know C,just do whatever u know(i mean ANSI C and POSIX C).Else try learning C.
Or did u mean some high funda things i was not able to follow??Then sorry,i cant help u.
 
Old 08-02-2003, 09:44 AM   #3
Tesl
Member
 
Registered: Jun 2003
Location: Durham, UK
Distribution: Slackware 9, Mandrake 9.1
Posts: 163

Rep: Reputation: 30
do you actually know C? these sorts of things are usually taught early on

whenever i program in C (not too often i must admit) i would do something as follows:

Code:
#include <iostream.h>

// Your other includes, main() function whatever

int Input;
cout << "Enter a number: ";
cin  >> Input;
then again, i had someone new to C complaining about that saying it should be #include <iostream> and using std::cout rather than just cout. Iv been doing Java mostly of late so not totally up to speed

EDIT - i dont know if your question is more about whether you can use the same code in Linux as you would when coding in windows, to bring the Dos prompt. Its normally exactly the same.

Last edited by Tesl; 08-02-2003 at 09:46 AM.
 
Old 08-02-2003, 01:03 PM   #4
yanming
LQ Newbie
 
Registered: Aug 2003
Location: US
Distribution: RedFlag
Posts: 2

Original Poster
Rep: Reputation: 0
Yes, I fogot many things I learned years ago. Sorry.

Actually, I can use getchar(), read(), getc(stdin), or maybe
fscanf(stdin, ...).

The cin and cout are C++ stuff.
 
Old 07-27-2007, 02:51 AM   #5
actsby
LQ Newbie
 
Registered: Jul 2007
Posts: 2

Rep: Reputation: 0
Question Send Data From Application to PS/2 Port

I have designed small circuit using PS/2 port for communication with PC. Its easy to send data from my circuit to application(the data is treated as normal keypress)

but I don't know, How to send data from application (using C language) to PS/2 keyboard port ?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Switching input keyboard language in Linux fabianrios Linux - Software 3 09-15-2005 05:46 PM
No keyboard input under gnome. gatdrydock Linux - Software 1 07-10-2005 04:15 PM
my mouse input is takes as keyboard input in BASH e1000 Slackware 5 12-08-2003 04:00 PM
Keyboard input not on screen g_rat Programming 1 03-28-2003 12:50 AM
No keyboard input seen neo77777 Linux - General 5 07-12-2002 10:32 PM


All times are GMT -5. The time now is 03:24 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration