Read header and data from a binary file [LONG]

2009-09-23 Thread Jose Rafael Pacheco
Hello, I want to read from a binary file called myaudio.dat Then I've tried the next code: import struct name = myaudio.dat f = open(name,'rb') f.seek(0) chain = 4s 4s I 4s I 20s I I i 4s I 67s s 4s I s = f.read(4*1+4*1+4*1+4*1+4*1+20*1+4*1+4*1+4*1+4*1+4*1+67*1+1+4*1+4*1) a =

Read header and data from a binary file

2009-09-22 Thread Jose Rafael Pacheco
Hello, I want to read from a binary file called myaudio.dat Then I've tried the next code: import struct name = myaudio.dat f = open(name,'rb') f.seek(0) chain = 4s 4s I 4s I 20s I I i 4s I 67s s 4s I s = f.read(4*1+4*1+4*1+4*1+4*1+20*1+4*1+4*1+4*1+4*1+4*1+67*1+1+4*1+4*1) a =