getch() problem in linux - Linux

This is a discussion on getch() problem in linux - Linux ; Hello, I use 'getch' to read the input from stdin, it seems not to work via serial port,using null-modem cable, is 'getch' not compatibal with the serial port( com1) or some special settings needs to be set? thanks...

+ Reply to Thread
Results 1 to 2 of 2

Thread: getch() problem in linux

  1. getch() problem in linux

    Hello,

    I use 'getch' to read the input from stdin, it seems not to work via
    serial port,using null-modem cable, is 'getch' not compatibal with the
    serial port( com1) or some special settings needs to be set?

    thanks

  2. Re: getch() problem in linux

    one2001boy@yahoo.com wrote:

    > Hello,
    >
    > I use 'getch' to read the input from stdin, it seems not to work via
    > serial port,using null-modem cable, is 'getch' not compatibal with the
    > serial port( com1) or some special settings needs to be set?


    $ man getch
    ....
    DESCRIPTION
    The getch, wgetch, mvgetch and mvwgetch, routines read a
    character from the window. In no-delay mode, if no input
    is waiting, the value ERR is returned. In delay mode, the
    program waits until the system passes text through to the
    program. Depending on the setting of cbreak, this is
    after one character (cbreak mode), or after the first new*
    line (nocbreak mode). In half-delay mode, the program
    waits until a character is typed or the specified timeout
    has been reached.


    It's probably a case of needing to change 'cbreak' on the source "file" so
    that characters arrive one at a time as opposed to a line at a time which is
    then buffered and read by getch.


+ Reply to Thread