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

C Language

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 sending by ioctl call, is
there any additional settings to do (setting termios, keyboard driver?)??

wrote in comp.lang.c:


Your post is still off-topic in comp.lang.c and comp.lang.c++.

It still belongs in a Linux group.