If you can figure out how to send characters to the device at all , it's easy
enough to send escape sequences. In ASCII, the ESC code is 033 (27 decimal), so
code like
fprintf(ofd, "33[J");
sends the sequence ESC [ J .
Some programmers prefer to parameterize the ESC code, like this:
#define ESC 033
fprintf(ofd, "%c[J", ESC);