Termcap “cl” command doesn't clear screen
问题 I can't seem to get termcap 's "cl" command to work, but the terminal escape code does. For example: #include <termcap.h> #include <stdio.h> int main() { tputs(tgetstr("cl", NULL), 1, putchar); } This doesn't change the terminal. But when I run: #include <stdio.h> int main() { printf("\e[2J"); } or if I call echo `tput cl` The terminal is cleared. Why does this happen? Shouldn't termcap give that same escape code? EDIT: Fixed writing characters EDIT2: It's because i didn't call tgetent()