From: nobu.nokada@... Date: 2003-05-30T04:59:05+09:00 Subject: Re: RCR: unpack/pack Bignum Hi, At Thu, 29 May 2003 20:37:07 +0900, Robert Feldt wrote: > > > How can this be used when I have a Bignum that I don't know how large it > > > will be? 'N(*)'? > > > > I expect '(*)' would mean to convert all remained data like as > > 'a*' does, though you need to know the exact template to pack/ > > unpack fundamentally. > > > Yes, but this should work then > > s = [large_bignum_or_really_any_int].pack("N(*)") > num = s.unpack("N(#{s.length})").first > # now num == large_bitnum_or_really_any_int > > ? By analogy with "a*", IMHO, it should fill least necessary bytes (or words?). But I don't guess variable length integer packing is so useful. If the range were really unpredictable, BER might be better. -- Nobu Nakada