[Raleigh-talk] Forcing 32 bit int with pack
James Olin Oden
james.oden at gmail.com
Thu Feb 15 09:56:30 PST 2007
I was writting some code where I needed to pack some integers to then
be read by something else. The problem (at least mentally) I ran into
was how do I know the size of the int that pack created. Now I know
on 32 bit systems its typically 32 bits, and thus 4 bytes, but on 64 bit
that changes. I did figure out I could actually pack a fake buffer
with two ints on the reader side and get their length, but that only
works on the same machine (which is good enough in my case, but I'm
still curious). How though, could I force it to create 32 bit ints?
Would I use "n" (for network) when I packed them?
More information about the Raleigh-talk