Here i am putting value in map through readDumpFile() function, and retrieving it through getSymbolFromSymbolMap() function. When i try to find on particular value in map, i am able to get the value through iterator , but the value which i get(char *) is garbage value . But if i use std::map<int, char*> symbolMap instead of char* one then i am able to get proper value.
Can anyone explain why i am getting garbage value in first case?
It does accomodate a char*, and assigns the correct value too.
The problem is that once you've gone around the loop, you reassign token's value. The pointer you've stored in the map now no longer points to what you think it points to. That string you set it up to point to is gone.