For some reason the following code jumps from the first case to the default case :
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;
        }
    }
This jumps from CHUNK_MAIN case to the default case ,although this code:
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;
        }
    }
jumps from CHUNK_MAIN case to the CHUNK_EDIT case. Is this an error related to C++ syntax or is this possible something else?

cheers