Simple text user interface question
Thu Aug 4 08:52:30 CEST 2005
"Vlad Dumitrescu" <> wrote:
>>I have to insert records in a database and would like to print the number
>inserted so far on a console. Is
>>there an easy way (without using slang, etc) to print the number always on
>the same line, the new
>>number overwriting the prior one (something like asking for a carriage
>return without a line feed)?
>The short answer is "not in a portable way".
>The long answer is "you can hack something up, for your own machine and
>environment, but it's probably more work than it's worth".
Hm, well, for cursor positioning in general that may be true, and I'm
sure there are *some* systems it would not work on, but for anything
that faithfully displays the text it receives doing exactly the
"something like" above works just fine - no ANSI support needed. I.e.
try this with e.g. l(1,10):
io:format("\r~w ", [M]),
receive after 1000 -> ok end,
Will be a bit messy on a printing terminal, but should follow the spec
More information about the erlang-questions