📅  最后修改于: 2020-11-04 05:57:26             🧑  作者: Mango
使用称为二进制的数据结构来存储大量原始数据。二进制文件以比列表或元组更节省空间的方式存储数据,并且运行时系统针对二进制文件的有效输入和输出进行了优化。
二进制文件以整数或字符串序列的形式编写和打印,并以小于和大于括号的两倍括起来。
以下是Erlang中二进制文件的示例-
-module(helloworld).
-export([start/0]).
start() ->
io:fwrite("~p~n",[<<5,10,20>>]),
io:fwrite("~p~n",[<>]).
当我们运行上面的程序时,我们将得到以下结果。
<<5,10,20>>
<>
让我们看一下可用于Binaries的Erlang函数-
Sr.No. | Methods & Description |
---|---|
1 |
This method is used to convert an existing list to a list of binaries. |
2 |
This method is used to split the binary list based on the index position specified. |
3 |
This method is used to convert a term to binary. |
4 |
This method is used to check if a bitstring is indeed a binary value. |
5 |
This method is used to extract a part of the binary string |
6 |
This method is used to convert a binary value to a float value. |
7 |
This method is used to convert a binary value to a integer value. |
8 |
This method is used to convert a binary value to a list. |
9 |
This method is used to convert a binary value to an atom. |