   How do i do this?
  Hey, this->FrameMap[ a ] = (int *)xAnimationFrame->GetText();FrameMap is type <string, int *> What im trying to do is retrieve the frame number form a tag in my xml file. Now if i have this->FrameMap[ a ] = &someint;it works. So my question is how do i ADD the value from the frame to the int array in FrameMap. It forces me to typecast to (int *) of course, and i think this is messing it up, its jsut assigning another pointer.   
  You should convert your text to an integer. Try 'atoi' function.   ;  er sorry i already did that the original function wasthis->FrameMap[ a ] = (int *)atoi(xAnimationFrame->GetText());and it still didnt work. it crashes when i try to assign something.switch(Dir){case 0:m_it=FrameMap.find( "North" );//m_it is an iterator for FrameMapm_CurrentFrame=*m_it->second; //THIS LINE IS WHAT MAKES IT CRASH   ;Quote:this->FrameMap[ a ] = (int *)atoi(xAnimationFrame->GetText());this is incorrect. atoi returns you an integer on stack and you reinterpret it as an address.if you want a pointer to it, you have to store the result (or use map<string,int>)i suggest you learn a bit more about C pointers.;Quote:Original post by Mathius20er sorry i already did that the original function wasthis->FrameMap[ a ] = (int *)atoi(xAnimationFrame->GetText());and it still didnt work. it crashes when i try to assign something.switch(Dir){case 0:m_it=FrameMap.find( "North" );//m_it is an iterator for FrameMapm_CurrentFrame=*m_it->second; //THIS LINE IS WHAT MAKES IT CRASHThe above poster is correct, but are you sure your frame map has a "North" in it?   Otherwise FrameMap.find() == FrameMap.end(), and you certaintly don't want to dereference end().   ;  Well, Its not crashing now, the character just disappears when i move north. If i insert an actual number then it works.   int *FrameNum;FrameNum = (int *)malloc(sizeof(int));while(xAnimationFrame) {int Frame = atoi(xAnimationFrame->GetText());*FrameNum = Frame;//FrameNum++;xAnimationFrame=xAnimationFrame->NextSiblingElement("Frame");}FrameNum = (FrameNum -3);this->FrameMap[ xAnimationSet->Attribute("Name") ] = FrameNum;I wanted to fill the FrameNum with integers b4 i just passed the whole array itself to FrameMap, but with this code, the character moves north without disappearing, but the frame doesnt change, and if (FrameNum -3) is anything other than 3 he just disappears.[Edited by - Mathius20 on May 28, 2006 8:11:56 AM]