Hide cursor on remote terminal

I have an open socket for a remote terminal. Using the answer to force the telnet client into character mode . I was able to set this terminal to character mode.

My question is: how to hide this cursor in a remote terminal using this method?

+7
c terminal sockets cursor
Apr 15 2018-10-15T00:
source share
4 answers

This is what the ncurses library can do for you.

The curs_set() function can make the cursor invisible.

+8
Apr 20 '10 at 16:44
source share

To deploy mjh2007's answer, the following c / C ++ code will implement sending escape codes to the terminal and read a bit more than raw hexadecimal numbers.

 void showCursor(bool show) const { #define CSI "\e[" if (show) { fputs(CSI "?25h", stdout); } else { fputs(CSI "?25l", stdout); } #undef CSI } 
+9
Mar 07 '12 at 15:33
source share

If your terminal supports ANSI format, you can send the following escape codes :

 Hide the cursor: 0x9B 0x3F 0x32 0x35 0x6C
 Show the cursor: 0x9B 0x3F 0x32 0x35 0x68
+4
Apr 20 '10 at 20:20
source share

If this application is telnet, your application must send IAC WILL ECHO to disable echo on its side. This is useful for entering passwords or if your application is 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.

+3
Apr 20 '10 at 16:39
source share



All Articles