Q: How do I send escape sequences to control a terminal or other device?
A: If you can figure out how to send characters to the device at all (see question 19.8), it's easy enough to send escape sequences. In ASCII, the ESC code is 033 (27 decimal), so code like
fprintf(ofd, "\033[J");sends the sequence ESC [ J .
Some programmers prefer to parameterize the ESC code, like this:
#define ESC 033 fprintf(ofd, "%c[J", ESC);