'bytes' is for packing binaries, not numbers. The working example you have is the correct way to do it. <br><br>On Friday, December 12, 2014, Santosh Kumar <<a href="mailto:santosh79@gmail.com">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>