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

K

Keeper

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
 
V

Victor Bazarov

Keeper said:
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
 
J

Jack Klein


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
--
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top