c++ - Can't find the cause of an unhandled exception -
i writing parser .obj files, , unhandled exception being thrown somewhere within loop code block, , unable find it. visual studio error message saying it's @ ntdll.dll. code breaks in ostream file. when use breakpoints, program doesn't crash before quite few iterations.
//intitialising index array part , returning start of vertex defining period //icount number of indices being read in //position saved position within .txt file has been reached data[k].indices = new triangle[icount]; data[k].noindices = icount; data[k].vertex = new point3d[icount]; int a,b,c,d,e,f; int check = 0; infile.seekg(position - 1); cout << "icount" << icount << endl; //getting index data for(int j = 0; j < icount; j++) { char buff[40]; infile.getline(buff, 40); int matched = sscanf(buff, "f %d/%d %d/%d %d/%d", &a, &b, &c, &d, &e, &f); //zero align indices , store data data[k].vertex[j].x = b - 1; data[k].vertex[j].y = d - 1; data[k].vertex[j].z = f - 1; //zero align indices , store data data[k].indices[j].a = - 1; data[k].indices[j].b = c - 1; data[k].indices[j].c = e - 1; }
edit: when code block added in, fail written console until heap corrupts. because sscanf() returns -1 after first iteration if being run without breakpoints
if(matched != 6) { cout << "fail"; }