I know that printing a \r will put the cursor at the beginning of the line, from which I can then type over the existing text. However, I want to clear that text first so that there isn't any stray text left at the end. I could output a bunch of spaces, but in this case I don't know how long the previous line was, nor how wide the terminal is. I have seen a 'ce' type in termcap, but I would rather avoid using termcap as it is no longer used on newer systems.
Thanks,
Nicodemus