Hide cursor on remote terminal

前端 未结 4 656
-上瘾入骨i
-上瘾入骨i 2020-12-17 22:34

I have an open socket to a remote terminal. Using the answer to \"Force telnet client into character mode\" I was able to put that terminal into character mode.

My q

4条回答
  •  忘掉有多难
    2020-12-17 23:02

    If this is using the 'telnet' application then your app should send 'IAC WILL ECHO' to disable echoing on their remote side. This is useful for entering passwords or if your app is doing the echoing.

    #define TEL_IAC "\377"
    #define TEL_WILL "\373"
    #define TEL_ECHO "\001"
    
    char buf[4];
    snprintf(buf, sizeof(buf), "%c%c%c" TEL_IAC, TEL_WILL, TEL_ECHO);
    write(sock, buf, sizeof(buf));
    

    Or

    write(sock, TEL_IAC TEL_WILL TEL_ECHO, 3);
    

    Hope this helps.

提交回复
热议问题