can anyone help me with this switch statement? i want it to go through line by line my file and, in the cases, increment x, y and z counts depending on the value of each digit in the strings. i debugged and its giving me some stupid value for xcount. dont know if its infinite or not. anyone help?
// Allocate memory to hold the vertices
g_pVertices = new CVector3 [ g_NumberOfAdds ];
//create counter index for array
int index = 0;
char szBuf[256];
while( fgets(szBuf,256,fp) )
{
int nLineLen = strlen(szBuf);
for ( int i = 0; i < nLineLen; i++ )
{
float xCount = 0;
float yCount = 0;
float zCount = 0;
switch( szBuf[i] )
{
default: // don't do anything
break;
case '0': //default
break;
case '1': xCount++;
break;
case '2': yCount++;
break;
case '3': xCount++;
yCount++;
break;
case '4': zCount++;
break;
case '5': xCount++;
zCount++;
break;
case '6': yCount++;
zCount++;
break;
case '7': xCount++;
yCount++;
zCount++;
break;
}
xCount = g_pVertices[index].x;
yCount = g_pVertices[index].y;
zCount = g_pVertices[index].z;
index++;
}
}