How to print escape?

Klacke klacke@REDACTED
Thu Apr 18 09:56:00 CEST 2002


On Wed, Apr 17, 2002 at 06:28:55PM -0600, Chris Moline wrote:
> hi, to learn erlang i am implementing a simple rogue-like game. my 
> problem is that i cant seem to print escape. i have tried
> 
> io:fwrite("~c[34m", [27]).
> io:format("~c[34m", [27]).
> io:put_chars([27,91,51,52,109]).
> 
> all three of them print ^[[34m instead of causing the foreground color 
> to become blue. how can i fix this?
> 
> sincerly,
> chris moline


Doing tty/terminal stuff using the normal erlang i/o function is hard 
or even downright impossible. 
Your best bet for tty stuff is to use my slang interface which 
available at http://erlang.org/user.html

This is a one 2 one mapping between erlang and the slang tty functions.
(slang is a general purpose portable tty library)

On ther other hand, since you said that you were actually learning erlang
just right now, the slang library may be a bit hard to use.....


/klacke


-- 
Claes Wikstrom                        -- Caps lock is nowhere and
Alteon WebSystems                     -- everything is under control          
http://www.bluetail.com/~klacke      
cellphone: +46 70 2097763



More information about the erlang-questions mailing list