Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hide cursor on remote terminal

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 question is, how do I hide the cursor in the remote terminal using this method?

like image 864
Tyler Avatar asked Apr 15 '10 23:04

Tyler


1 Answers

To expand upon mjh2007's answer, the following c/c++ code will implement sending the escape codes to the terminal, and is slightly more readable than raw hex numbers.

void showCursor(bool show) const {
#define CSI "\e["
  if (show) {
    fputs(CSI "?25h", stdout);
  }
  else {
    fputs(CSI "?25l", stdout);
  }
#undef CSI
}
like image 50
joesdiner Avatar answered Oct 03 '22 23:10

joesdiner