# output format of term_to_binary & the logic inside it ??

Sanjaya Vitharana <>
Fri Jul 8 10:32:51 CEST 2005

```Hi...!!

Can, anybody explane me the output format of term_to_binary & the logic inside it ??

What is the Erlang binary data object & Erlang external term format ?

NOTE:
If this is already described in someware in your documentation kindly help me to find ....

Ex1:
70> term_to_binary(255).

<<131,97,255>>    --- What is <<131,97...??

71> term_to_binary(256).

<<131,98,0,0,1,0>> --- Why this change from 97 to 98 <<131,98

72> term_to_binary(257).
<<131,98,0,0,1,1>>     --- . Also <<131,98,0,0, what means from 0.0
73> term_to_binary(258).
<<131,98,0,0,1,2>>

Ex2:

58> term_to_binary(2).

<<131,97,2>>    --- <<131,97 -- may be 2 places to discribe the integer type

59> term_to_binary(a).

<<131,100,0,1,97>> --- <<131,100,0 -- anyhow why this becoms 3 places to discribe a atom.

60> term_to_binary(aa).
<<131,100,0,2,97,97>> ----- What actually means <<131,100,0 ???

Ex3:

Also see the difference in List & Tuple

61> term_to_binary([1,2,3]).

<<131,107,0,3,1,2,3>> --- 107  is for Lists ???

62> term_to_binary({1,2,3}).

<<131,104,3,97,1,97,2,97,3>> --- 104 is for Tuples ???

63> term_to_binary({{1,2,3},1}).

<<131,104,2,104,3,97,1,97,2,97,3,97,1>> --- <<131,104,2, - 2 means number of eliments in a tuple is it ??? so 131 is for ???

Where is the actual location discribe this all Erlang binary types ?

Regards,

Need some help !!!

Sanjaya

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20050708/801bdf44/attachment.html>
```

More information about the erlang-questions mailing list