Erlang - term_to_binary

Questo metodo viene utilizzato per convertire un termine in binario.

Sintassi

term_to_binary(term)

Parametri

  • term - Questo è il termine valore che deve essere convertito in un valore binario.

Valore di ritorno

Restituisce un valore binario basato sul termine specificato.

Per esempio

-module(helloworld). 
-export([start/0]). 

start() -> 
   io:fwrite("~p~n",[term_to_binary("hello")]).

Produzione

Quando eseguiamo il programma sopra, otterremo il seguente risultato.

{<<131,107,0,5,104,101,108,108,111>>}