changing pseudo tty echo mode from the master side

前端 未结 3 984
情书的邮戳
情书的邮戳 2021-01-23 03:28

On linux, I am opening a pseudo tty on the master side. While there is no client on the slave side, the pseudo tty seems to be echoing everything I am writing to him, which is n

相关标签:
3条回答
  • 2021-01-23 04:10

    I thought the master side was not a tty, but apparently it is, so you can call things like tcgettattr and tcsetattr, and suppress the echo.

    0 讨论(0)
  • 2021-01-23 04:29

    None of the older answers provided the correct C code, so here it is:

    struct termios tmios;
    tcgetattr(ptfd, &tmios);
    tmios.c_lflag &= ~(ECHO);
    tcsetattr(ptfd, TCSANOW, &tmios);
    
    0 讨论(0)
  • 2021-01-23 04:33

    You can use the blocking getch() call. Also getch() will not echo the content.

    0 讨论(0)
提交回复
热议问题