The bold line below causes an access violation, I dont understand why... The second copy is what I did to fix it, can someone explain why the first one dosen't work?
Code:
char* t = new char[10];
//load texture paths
for(int i = 0; i < 5; i++) {
//get the texture level by id
string texLevel = "TextureLevel";
texLevel += _itoa(i+1,t,10);
t = " ";
temp->numTextures[i] = GetIntFromINI(texLevel,"Count",file,0);
//load all the paths on that level
for(int j = 0; j < temp->numTextures[i]; j++) {
string path = "Path";
path += _itoa(j+1,t,10);
t = " ";
temp->textureList[i].push_front(new string(GetFromINI(texLevel,path,file,"")));
}
}
delete [] t;
Code:
char* t;
//load texture paths
for(int i = 0; i < 5; i++) {
//get the texture level by id
string texLevel = "TextureLevel";
t = new char[10];
texLevel += _itoa(i+1,t,10);
delete [] t;
temp->numTextures[i] = GetIntFromINI(texLevel,"Count",file,0);
//load all the paths on that level
for(int j = 0; j < temp->numTextures[i]; j++) {
string path = "Path";
t = new char[10];
path += _itoa(j+1,t,10);
delete [] t;
temp->textureList[i].push_front(new string(GetFromINI(texLevel,path,file,"")));
}
}
delete [] t;