Pascal Bourguignon <pjb@informatimago.com> wrote:
+---------------
| "phertmuller" <phertmuller@gmail.com> writes:
| > How can I do to get these numbers in the same position ? (So, after
| > printing 0, clean the output, and print the 1 in the same position).
...
| Now, if you just want a quick-and-dirty solution, you can use the
| Carriage Return ASCII code, in most terminal it will move the cursor
| at the beginning of the line without advancing to the next line:
|
| (loop for x from 0 below 3
| do (format t "~C~4D" (code-char 13) x)
| (sleep 1))
+---------------
In many Common Lisps, especially on Unix/Linux, formatted output
is not automatically flushed from buffers by a #\Return, only by
a #\LineFeed, so to get this to work as expected you will need to
add a (FORCE-OUTPUT) before the (SLEEP 1) [and similarly with the
CUP example later]:
(loop for x from 0 below 3
do (format t "~C~4D" (code-char 13) x)
(force-output)
(sleep 1))
-Rob
-----
Rob Warnock <rpw3@rpw3.org>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)572-2607