3

I am using Windows as OS and installed Erlang 16B. How do i clear my screen?

I have already tried :

clrscr().

clearscreen().

cls().

But failed each and every time.

(May be very simple question but i am not able to find the solution.)

Madhusudan Joshi
  • 4,438
  • 3
  • 26
  • 42

2 Answers2

6

Type the below command to your erlang shell. io:format(os:cmd(clear)). And off you go :)

anuj pradhan
  • 2,777
  • 4
  • 26
  • 31
  • I like this better than doing `io:format("\033[2J").`, because it also takes the current line to the top of the screen rather than at the bottom. Thanks! P.S. This was on OSX + iterm. – Indradhanush Gupta Mar 19 '17 at 09:56
2

The author of the following link/answer suggests to use io:format.

http://erlang.org/pipermail/erlang-questions/2014-November/081939.html

Write your own function call:

clear() ->
    io:format("\033[2J").
Peter Paul Kiefer
  • 2,114
  • 1
  • 11
  • 16
  • That is unlikely to work in a *Windows* console as OP appears to be requesting, but only in something like a Cygwin or MinGW shell (which use a terminal emulator). – Thomas Dickey Jun 25 '15 at 22:30
  • @ThomasDickey Yes, I agree! Every time I read the word windows, my eyes get blind. ;-) Here is a usefull link: http://stackoverflow.com/questions/16755142/how-to-make-win32-console-recognize-ansi-vt100-escape-sequences – Peter Paul Kiefer Jun 26 '15 at 16:16