Binary matching

Vance Shipley vances@REDACTED
Tue Dec 21 23:41:54 CET 2004


Danie,

That would make Rest a binary of 1 bit which is illegal.

	-Vance


On Wed, Dec 22, 2004 at 12:20:03AM +0200, Danie Schutte wrote:
}  On Mon, 2004-12-20 at 12:39 -0200, Inswitch Solutions - Erlang
}  Evaluation wrote:
}  
}  >  
}  > Does someone know why the following binary matching fails?
}  >  <<X:7/binary, Rest/binary>> = <<0>>
}  
}  I think the problem lies with the fact that X:7/binary will look for 7
}  binary BYTES of data and not 7 BITS.
}  <<X:7, Rest/binary>> = <<0>> might be more what you are looking for.
}  
}  
}  >  
}  > Is there an elegant way to group an octect binary in seven bits
}  > values?
}  > For example eight characters (1 character = 1 byte) in seven octects.
}  >  
}  >  
}  > thanks,
}  > Eduardo Figoli
}  > INSwitch Solutions
}  >  
}  >  
}  >  
}  >  
}  >  
}  
}  -- 
}  Danie Schutte <danie@REDACTED>
}  Erlang Financial Systems



More information about the erlang-questions mailing list