<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.2.2">
</HEAD>
<BODY BGCOLOR="#ffffff">
On Mon, 2004-12-20 at 12:39 -0200, Inswitch Solutions - Erlang Evaluation wrote:<BR>
<BLOCKQUOTE TYPE=CITE>
<FONT COLOR="#000000"> </FONT><BR>
<FONT SIZE="2"><FONT COLOR="#000000">Does someone know why the following binary matching fails?</FONT></FONT><BR>
<FONT SIZE="2"><FONT COLOR="#000000"> <<X:7/binary, Rest/binary>> = <<0>></FONT></FONT><BR>
</BLOCKQUOTE>
I think the problem lies with the fact that X:7/binary will look for 7 binary BYTES of data and not 7 BITS.<BR>
<<X:7, Rest/binary>> = <<0>> might be more what you are looking for.<BR>
<BR>
<BLOCKQUOTE TYPE=CITE>
<FONT COLOR="#000000"> </FONT><BR>
<FONT SIZE="2"><FONT COLOR="#000000">Is there an elegant way to group an octect binary in seven bits values?</FONT></FONT><BR>
<FONT SIZE="2"><FONT COLOR="#000000">For example eight characters (1 character = 1 byte) in seven octects.</FONT></FONT><BR>
<FONT COLOR="#000000"> </FONT><BR>
<FONT COLOR="#000000"> </FONT><BR>
<FONT SIZE="2"><FONT COLOR="#000000">thanks,</FONT></FONT><BR>
<FONT SIZE="2"><FONT COLOR="#000000">Eduardo Figoli</FONT></FONT><BR>
<FONT SIZE="2"><FONT COLOR="#000000">INSwitch Solutions</FONT></FONT><BR>
<FONT COLOR="#000000"> </FONT><BR>
<FONT COLOR="#000000"> </FONT><BR>
<FONT COLOR="#000000"> </FONT><BR>
<FONT COLOR="#000000"> </FONT><BR>
<FONT COLOR="#000000"> </FONT><BR>
</BLOCKQUOTE>
<TABLE CELLSPACING="0" CELLPADDING="0" WIDTH="100%">
<TR>
<TD>
-- <BR>
Danie Schutte <<A HREF="mailto:danie@erlfinsys.net">danie@erlfinsys.net</A>><BR>
Erlang Financial Systems
</TD>
</TR>
</TABLE>
</BODY>
</HTML>