Binary file Pt 1 - Only reading some

2008-02-04 Thread Mastastealth
I'm trying to create a program to read a certain binary format. I have the format's spec which goes something like: First 6 bytes: String Next 4 bytes: 3 digit number and a blank byte --- Next byte: Height (Number up to 255) Next byte: Width (Number up to 255) Next byte: Number 0 - 5 Every 2 bytes

Re: Binary file Pt 1 - Only reading some

2008-02-05 Thread Mastastealth
On Feb 5, 1:17 am, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > Using the struct module  http://docs.python.org/lib/module-struct.html > > import struct > data = info.read(15) > str1, str2, blank, height, width, num2, num3 = > struct.unpack("6s3s1cBBBh", data) > > Consider this like a "first atte

Re: Binary file Pt 1 - Only reading some

2008-02-05 Thread Mastastealth
On Feb 5, 8:50 am, Mastastealth <[EMAIL PROTECTED]> wrote: > What is this value for? "6s3s1cBBBh" and why is my unpack limited to a > length of "16"? > > Unfortunately it seems my understanding of binary is way too basic for > what I'm deali