[erlang-questions] How to display a record ?
Maria Christakis
el03665@REDACTED
Sun Jun 7 19:41:22 CEST 2009
Hello,
Are you sure you used io:format("~p~n", [A]) rathen than
io:format("~w~n", [A])?
Maria
info wrote:
> I tried but I obtain:
> {person,[106,111,104,110],[49,50,51,52]}ok
>
> Try this:
>
> io:format("~p~n", [A])
>
> Remember records are just tagged tuples at runtime, so you'll get
> something like so:
>
> {person,"john","1234"}
>
> Sean
>
> Gamoto wrote:
>
>> Hello,
>> Is it possible to display a record instead of its content ?
>> Example:
>>
>> -record (person,{name,phone}).
>> init()- >
>> A=#person{name="john",phone="1234"},
>> io:format([A]), *** hangs ***
>> %% but
>> io:format("~s~n",[A1#person.phone]). *** display phone ***
>>
>>
>> ________________________________________________________________
>> erlang-questions mailing list. See http://www.erlang.org/faq.html
>> erlang-questions (at) erlang.org
>>
>>
>>
>>
>
>
> ________________________________________________________________
> erlang-questions mailing list. See http://www.erlang.org/faq.html
> erlang-questions (at) erlang.org
>
>
More information about the erlang-questions
mailing list