Ive narrowed the issue down to a few lines of code but im having trouble identifying what is illegal about the function call causing a “Access violation writing location” I was hoping someone better with C could help me out?
The input the code is breaking on is
vn 0.185492 -0.005249 0.982604
I want to assign the 3 float values to an Array of Struct vn
struct Normals{
float vn1;
float vn2;
float vn3;
};
struct Normals vn[50000];
and the code that is crashing is
if (line[0] == 'v' && line[1] == 'n' && line[1] != 't'){
sscanf(line, "%*c%*c%f%f%f",
&vn[normCount].vn1,
&vn[normCount].vn2,
vn[normCount].vn3);
normCount++;
}
Any tips would be great! Thanks
You forgot the
&beforevn[normCount].vn3.By the way, what is the point of
line[1] == 'n' && line[1] != 't'?