in reply to Re^2: output on top of old output
in thread output on top of old output

Basically, xorl, "\b" backs up one char, while "\r" rewinds the whole line :-)

Remember, if you print a newline character, you won't be able to use these control characters to erase it.

Replies are listed 'Best First'.
Re^4: output on top of old output
by Tanktalus (Canon) on Mar 22, 2005 at 16:27 UTC

    I think it'd be just as handy to use their real names: \b == backspace (go back one space), and \r == carriage return (return to the beginning of the line). Originally, these were from the terminal printer days and were just directives to the print head to do exactly that. Carriage returns (returning the carriage to the beginning of the line) were not intrinsically linked to new lines, so we get different characters for these activities.