<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif">Hrm, I'm not sure I understand. Here's some code:</div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default"><p style="margin:0px;font-size:15px"><font face="monospace">Num = 128.</font></p>
<p style="margin:0px;font-size:15px"><font face="monospace">128</font></p><p style="font-family:Menlo;margin:0px;font-size:15px"><br></p><p style="margin:0px"><font face="verdana, sans-serif">So, Num is a number. I then do:</font></p><p style="margin:0px;font-size:15px"><font face="monospace">BNum = <<Num>>.</font></p><p style="margin:0px;font-size:15px;font-family:Menlo"><br></p><p style="margin:0px;font-size:15px;font-family:Menlo"><span style="font-family:verdana,sans-serif;font-size:small">Now, BNum is a binary. I check it too:</span><br></p><p style="margin:0px;font-size:15px"><font face="monospace">is_binary(BNum).</font></p><p style="margin:0px;font-size:15px">
</p><p style="margin:0px;font-size:15px"><font face="monospace">true</font></p><p style="margin:0px;font-size:15px;font-family:Menlo"><br></p><p style="margin:0px;font-size:15px;font-family:Menlo"><span style="font-family:verdana,sans-serif;font-size:small">I now, try doing:</span><br></p><p style="margin:0px;font-size:15px"><font face="monospace">Packet = <<BNum:4/bytes>>.</font></p><p style="margin:0px;font-size:15px">
</p><p style="margin:0px;font-size:15px"><font face="monospace">** exception error: bad argument</font></p><p style="margin:0px;font-size:15px;font-family:Menlo"><br></p><p style="margin:0px"><font face="verdana, sans-serif">Here, I am trying to create another binary Packet, that is 4 bytes long as and has as it's contents BNum. If what you say is true and "</font><font face="monospace">/bytes</font><font face="verdana, sans-serif">" is used to pack Binary data this would work. Unless I am missing something.</font></p><p style="margin:0px"><font face="verdana, sans-serif"><br></font></p><p style="margin:0px"><font face="verdana, sans-serif">Thanks for your response.</font></p><p style="margin:0px"><font face="verdana, sans-serif"><br></font></p><p style="margin:0px"><font face="verdana, sans-serif">Santosh</font></p></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Dec 12, 2014 at 10:39 PM, Bob Ippolito <span dir="ltr"><<a href="mailto:bob@redivi.com" target="_blank">bob@redivi.com</a>></span> wrote:<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">'bytes' is for packing binaries, not numbers. The working example you have is the correct way to do it. <div class="HOEnZb"><div class="h5"><br><br>On Friday, December 12, 2014, Santosh Kumar <<a href="mailto:santosh79@gmail.com" target="_blank">santosh79@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif">Hi group,</div><div class="gmail_default" style="font-family:verdana,sans-serif">I was trying to pack a number into 4 bytes and was having a hard time doing it. Here is what I was trying:</div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default"><p style="font-family:Menlo;margin:0px;font-size:15px">102> Num = 128.</p>
<p style="font-family:Menlo;margin:0px;font-size:15px">128</p>
<p style="font-family:Menlo;margin:0px;font-size:15px">103> <<Num:4/bytes>>.</p>
<p style="font-family:Menlo;margin:0px;font-size:15px">** exception error: bad argument</p><p style="font-family:Menlo;margin:0px;font-size:15px"><br></p><p style="margin:0px"><font face="verdana, sans-serif">While this works:</font></p><p style="margin:0px"><font face="verdana, sans-serif"><br></font></p><p style="margin:0px;font-size:15px;font-family:Menlo">104> <<Num:32>>.</p><p style="margin:0px">
</p><p style="margin:0px;font-size:15px;font-family:Menlo"><<0,0,0,128>></p><p style="margin:0px;font-size:15px;font-family:Menlo"><br></p><p style="margin:0px"><font face="verdana, sans-serif">Here the packing into 32 bits works but the packing into 4 bytes fails. Not sure why.</font></p><p style="margin:0px"><font face="verdana, sans-serif"><br></font></p><p style="margin:0px"><font face="verdana, sans-serif">Any help, much appreciated.</font></p><p style="margin:0px"><font face="verdana, sans-serif"><br></font></p><p style="margin:0px"><font face="verdana, sans-serif">Thanks</font></p><p style="margin:0px"><font face="verdana, sans-serif">Santosh</font></p></div></div>
</blockquote>
</div></div></blockquote></div></div>