Printing list of integers in hexadecimal instead of decimal ?

Raimo Niskanen <>
Tue Sep 21 11:49:53 CEST 2004

 (. zist) writes:

No, there is not.

Using ~w you have printed a list of any terms in their default textual
representation, which for integers are decimal.

Write a loop(recurse), or use lists:foreach/2.

> <html><div style='background-color:'><DIV class=RTE>Hello,</DIV>
> <DIV class=RTE> </DIV>
> <DIV class=RTE>I have a list of integers, if I use io:format with a ~w format indication (io:format("~w",[List])),</DIV>
> <DIV class=RTE>the integers are printed in decimal, is there a way to print them in hexadecimal ?</DIV>
> <DIV class=RTE>(without printing each integer of the list one by one, as there is a possibility to print one integer in hexadecimal, with for instance ~2.16.0B).</DIV>
> <DIV class=RTE> </DIV>
> <DIV class=RTE>Thanks</DIV></div><br clear=all><hr>The new <a href="">MSN 8:</a> smart spam protection and 2 months FREE* </html>


/ Raimo Niskanen, Erlang/OTP, Ericsson AB

More information about the erlang-questions mailing list