By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,778 Members | 2,015 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,778 IT Pros & Developers. It's quick & easy.

How to simulate keyboard.../dev/tty0 ?

P: n/a
Hi all,

I'm trying to send chars to the current console (currently having cursor
focus) - /dev/tty0 - in my program by:

char st='K',ri='L',ng='J';
int tty;

tty = open(">/dev/tty0", O_WRONLY);

ioctl(tty, TIOCSTI, &st);
ioctl(tty, TIOCSTI, &ri);
ioctl(tty, TIOCSTI, &ng);

I'm using RedHat 9, kde.
Everything is ok in the linux console (on tty1 chars are sending
properly - KLJ...), but in kde i see strange things (and not only for
those characters):
^[[D- on ttyp1
- on mozilla window
My question is: why chars are not properly sendt by ioctl call, is there
any additional settings to do (setting termios, keyboard driver?)??

thanks,
Keeper

Jul 19 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"Keeper" <ke****@iosys.no-ip.org> wrote...
I'm trying to send chars to the current console (currently having cursor
focus) - /dev/tty0 - in my program by:

char st='K',ri='L',ng='J';
int tty;

tty = open(">/dev/tty0", O_WRONLY);

ioctl(tty, TIOCSTI, &st);
ioctl(tty, TIOCSTI, &ri);
ioctl(tty, TIOCSTI, &ng);

I'm using RedHat 9, kde.
Everything is ok in the linux console (on tty1 chars are sending
properly - KLJ...), but in kde i see strange things (and not only for
those characters):
^[[D- on ttyp1
- on mozilla window
My question is: why chars are not properly sendt by ioctl call, is there
any additional settings to do (setting termios, keyboard driver?)??


[answering in comp.lang.c++, where I read it]

You need to post your question to a Linux programming newsgroup.
Try comp.os.linux.development.*

Your question has nothing to do with either C or C++ language.

Victor
Jul 19 '05 #2

P: n/a
On Tue, 11 Nov 2003 11:25:04 +0100, Keeper <ke****@iosys.no-ip.org>
wrote in comp.lang.c:
Hi all,
Hi yourself.
I'm trying to send chars to the current console (currently having cursor
focus) - /dev/tty0 - in my program by:
I don't know about pl.comp.lang.c, because I don't read it, but I can
speak for comp.lang.c and comp.lang.c++, namely:

Your post is off-topic in these two groups at least. These groups
discuss, respectively, the standard C and C++ languages. And there is
no /dev/tty0 in either C or C++.
char st='K',ri='L',ng='J';
int tty;

tty = open(">/dev/tty0", O_WRONLY);
There is no open function in C or C++.
ioctl(tty, TIOCSTI, &st);
ioctl(tty, TIOCSTI, &ri);
ioctl(tty, TIOCSTI, &ng);
There is no ioctl function in C or C++.
I'm using RedHat 9, kde.
Everything is ok in the linux console (on tty1 chars are sending
properly - KLJ...), but in kde i see strange things (and not only for
those characters):
^[[D- on ttyp1
- on mozilla window
My question is: why chars are not properly sendt by ioctl call, is there
any additional settings to do (setting termios, keyboard driver?)??

thanks,
Keeper


Your question is about Linux, its system calls, and its file system,
not the C or C++ language. You will probably get excellent answers in
a group like news:comp.os.linux.development.aps.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++ ftp://snurse-l.org/pub/acllc-c++/faq
Jul 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.