[erlang-questions] Getting the number of columns of a terminal

Garrett Smith <>
Tue Jan 17 16:10:18 CET 2012


On Tue, Jan 17, 2012 at 8:27 AM, Jachym Holecek <> wrote:
> # Juan Jose Comellas 2012-01-17:
>> Does anybody know if there's any way of getting the number of columns
>> in a terminal in a portable way in Erlang (i.e. not using curses or
>> anything else that's not available on other platforms)? I need to wrap
>> some lines that I'm showing on a terminal and I'd rather use the real
>> terminal's width instead hardcoding it to 80 characters or so.
>
> io:columns/N should do it?

It never ceases to amaze me what's lurking the core libraries.



More information about the erlang-questions mailing list