pointer problem

Started by
2 comments, last by tcs 24 years ago
Hello... And I just have another problem ;-) Take a look at this function: void CMesh::GetFacesWithHSR(const CCamera *Camera, Face *pFacesOut, unsigned int &iFaceCountOut) { //////////////////////////////////////////////////// // Return a PVS for the passed camera object //////////////////////////////////////////////////// if (!Camera) { // No viewpoint is given, return all faces iFaceCountOut = m_iFaceCount; pFacesOut = m_pFaces; if (!pFacesOut) MessageBox(NULL,"","",NULL); } } I want to get a pointer to the m_pFaces list of my CMesh class. So I copy the member pointer into the passed one. I even check if the pointer is copied right. But when the function returns, the passed pointer (pFacesOut) is always unchanged... Am I to damn tired and overlooking something stupid ? Any help would be cool... Tim
Tim--------------------------glvelocity.gamedev.netwww.gamedev.net/hosted/glvelocity
Advertisement
If you want to change pFacesOut (declared as Face *pFacesOut) the way it looks like you want declare it as Face * &pFacesOut instead. In the function you only change the local pointer pFacesOut. If you do this it will change the pointer sent to the function.
Thanks man !

I already relized this, but I never seen such a declaration...
Tim--------------------------glvelocity.gamedev.netwww.gamedev.net/hosted/glvelocity
I had to use it a few day ago so I know it works. I just had to try because after writing it it looked very strage, but it works just fine.

This topic is closed to new replies.

Advertisement