Reputation: 2473
I am coding a shell-like in C and I want to implement the line edition functionality, I already implemented the basic of it, now I want to implement ctrl+l which clear the screen then display the prompt and the line I was working on.
I need to use the termcap :
'cm' String to position the cursor at line l, column c.
My question is how to I pass the variable l and c to the termcap ?
Upvotes: 1
Views: 482
Reputation: 3154
Suppose you have the cm
capability stored in the term_cm
variable. Then you would substitute parameters using the tgoto
function:
char *s = tgoto (term_cm, c, l);
tputs (s, 1, putchar);
Upvotes: 2
Reputation: 850
To clear the screen use this :
write(1, tgetstr("cl", 0), strlen(tgetstr("cl", 0)));
Upvotes: 0