Original Post
My pointer gets changed some strange way, but I don't know why. So my problem is that I don't get the correct position on my light, when calling the pFile->getLight(0); the function prints the memory adresses for both members of the light (name and position) and so it does just after retriving the light. giving bad result, the pLight->Name has the same memory address in both cases BUT not the m_Position so WHY? there is NOTHING that change the lights position.
// --- Code from my 3DS loader in static lib
CLight *CFile::getLight(int i)
{
if( i >= (int)m_LightList.size() )
return NULL;
CLight *pLight = m_LightList;
// Print out men address here
cout << "npos: " << &pLight->Name << endl;
cout << "lpos: " << &pLight->m_Position << endl;
// return pointer to light
return pLight;
}
// --- code from my .Exe file that use the static lib.
CLight *pLight = pFile->getLight(0);
cout << "name pos: " << &pLight->Name << endl;
cout << "light pos: " << &pLight->m_Position << endl;
// --- Light class
class CLight {
public:
char Name[21];
CVertex3f m_Position;
// Function to read data from 3DS file.
void readData(...);
};