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

Discussion in 'C Programming' started by Keeper, Nov 11, 2003.

  1. Keeper

    Keeper Guest

    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
     
    Keeper, Nov 11, 2003
    #1
    1. Advertising

  2. Keeper

    Jack Klein Guest

    On Tue, 11 Nov 2003 11:25:04 +0100, Keeper <-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
     
    Jack Klein, Nov 12, 2003
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Keeper
    Replies:
    1
    Views:
    1,225
    Brian McCauley
    Nov 11, 2003
  2. Keeper
    Replies:
    2
    Views:
    1,259
    Jack Klein
    Nov 12, 2003
  3. Keeper
    Replies:
    1
    Views:
    348
    Jack Klein
    Nov 12, 2003
  4. Keeper

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

    Keeper, Nov 11, 2003, in forum: C Programming
    Replies:
    1
    Views:
    361
    Jack Klein
    Nov 12, 2003
  5. Michael J Whitmore

    Simulate Mouse/Keyboard to stop Screen Saver

    Michael J Whitmore, Nov 6, 2003, in forum: Python
    Replies:
    1
    Views:
    1,341
    Dave Brueck
    Nov 6, 2003
Loading...

Share This Page