   problems when reading 3ds file
  I'm trying to create my own 3ds file reader, just for fun and learning purpose.But the problem is that it doesn't work the way I wan't to.here is the problem, I read a chunk in a loop like this: //few defines#define CHUNK_MAIN 0x4d4d#define CHUNK_EDITOR 0x3d3d#define CHUNK_MATERIAL 0xafff#define CHUNK_OBJECT 0x4000// The chunkclass Chunk {public: short id; int length;};// The code that doesn't workChunk chunk;int chunk_start;int chunk_end;while( !fin.eof() ){chunk_start = fin.tellg();fin.read( (char*)&chunk, sizeof(CChunk) );switch( chunk.id ){case CHUNK_MAIN:cout << "Main chunk found" << endl;break;case CHUNK_EDITOR:std::cout << "Editor chunk found with lengt(" << chunk.length <<" bytes)." << std::endl;chunk_end = chunk_start + chunk.length;while( fin.tellg() < chunk_end ){chunk_start = fin.tellg();fin.read( (char*)&chunk, sizeof(CChunk) );switch( chunk.id ){case CHUNK_MATERIAL:// the problem, it doesn't get herestd::cout << "Materials" << std::endl;fin.seekg(chunk_start + chunk.length);break;case CHUNK_OBJECT:cout << "Read objects" << endl;// Code cut, this works perfect.break;default://unknown chunk, just jump to next onecout << "unknown editor subchunk id: 0x" << hex << chunk.id << dec << " length " << chunk.length << " bytes" << endl;fin.seekg(chunk_start + chunk.length);break;};};break;default://unknown chunk, just jump to next chunkcout << "unknown: 0x" << hex << chunk.id << dec << " length " << chunk.length << " bytes" << endl;fin.seekg(chunk_start + chunk.length);break;};So the thing is that it doesn't get into the case CHUNK_MATERIAL block of code, it does skip the chunk in the default block because it is writing 'unknown: 0xafff length XXX bytes' but why doesn't it go inside the CHUNK_MATERIAL block?   