Calling on experts, gurus, and anybody to help read and parse a file in python.
On page 751 of 6th ed. or page 800 of 7th ed. of Superbible OpenGL there is Appendix
The next step has to be similar to what happens in the C code:
SB6M_HEADER * header = (SB6M_HEADER *)ptr;
ptr += header->size;
You need to advance the pointer by a known size.
You have that attribute in your header class. Do you set it correctly?
But I would suggest a different approach: do not use raw Pyhon for this at all.
Instead create a wrapper using the original C code found in sb6mfile.h
and a part of the function to read the file found in sb7object.cpp
Then access this code using Python's CFFI. You pass the C header with the SBM types to the files and can use them in Python.
Once this works you can get the data back and put it in a numpy array. Usually this is a bit of work but once it works it is really robust.
Here are some links to get you started:
buffer_size = np_arr.size*np_arr.dtype.itemsize
c_buffer = ffi.buffer(cffi_arr,buffer_size)
np_arr2 = np.frombuffer(c_buffer, dtype=np_arr.dtype)
(https://ammous88.wordpress.com/2014/12/30/numpy-array-with-cffi-c-function/)
https://docs.scipy.org/doc/numpy/reference/generated/numpy.frombuffer.html
How to pass a Numpy array into a cffi function and how to get one back out?
numpy.frombuffer(ffi.buffer(p, size)) https://bitbucket.org/cffi/cffi/issues/292/cant-copy-data-to-a-numpy-array#comment-31752678