When I run the program the data is populated properly. But its when I find for a element that puzzles me.
Initially I compiled the code through Visual Studio. The code worked fine. But when I compiled in Solaris using g++ the map find function didnt work as expected. The code compiles, in both machines. I dont know where I went wrong.
Thanks alot writetonsharma, the thing is when I hard code the key it gave me the required results. As you have done here.
But when I pass a char* to find method it gave me random results. I checked the value of the passd variable through VS2010 and found that the values are same.
char *val something like "C000003" when I cout in two different instances as shown in code below,
cout<<"--"<<val<<"--"<<endl;
On windows it gave me
--C000003--
but on Solaris
--C000003
As you can see the las two "--" isnt printed. So I had doubts in the char* that I was passing.