For some reason the following code jumps from the first case to the default case :
This jumps from CHUNK_MAIN case to the default case ,although this code:Code:while(file.read(chunk,2)) { switch(wordToshort(chunk)) { case CHUNK_MAIN: cout<<"In main chunk "<< (int(file.tellg())-2) <<endl; success=true; file.read(length,4); break; case CHUNK_EDIT: cout<<"In edit chunk"<< (int(file.tellg())-2) <<endl; file.read(length,4); break; case CHUNK_TRIMESH_VERTS: cout<<"In object chunk"<<(int(file.tellg())-2) <<endl; file.read(length,4); break; default: cout<<"In default"<<endl; file.read(length,4); file.seekg(wordToshort(length),ios::beg); break; } }
jumps from CHUNK_MAIN case to the CHUNK_EDIT case. Is this an error related to C++ syntax or is this possible something else?Code:switch(wordToshort(chunk)) { case CHUNK_MAIN: cout<<"In main chunk "<< (int(file.tellg())-2) <<endl; success=true; file.read(length,4); break; case CHUNK_EDIT: cout<<"In edit chunk"<< (int(file.tellg())-2) <<endl; file.read(length,4); break; case CHUNK_TRIMESH_VERTS: cout<<"In object chunk"<<(int(file.tellg())-2) <<endl; file.read(length,4); break; } }
cheers



LinkBack URL
About LinkBacks




. I don't mind the change in the 'chunk's value. It's just that the CHUNK_MAIN and CHUNK_EDIT cases should execute and not the CHUNK_MAIN and the default case. Things go well if there is no default case but as soon as the default case is added, it executes instead of the CHUNK_EDIT case.