I need to loop through the map, and send a const char array to the function to print it, I tried to use string cpy but the result is the same, it cannot convert a const string to a char. What am i doint wrong?
std::map <std::string, int>::const_iterator end = scores.end();
std::map<std::string, int>::const_iterator it;
for (it = scores.begin(); it != end; ++it)
{
char initials[4];
strcpy(initials,it->first);
//std::string s = "";
DrawString(screen, widthscreen/2 - (14*16)/4, heightscreen/2, initials,charsetsmall, 8);
You need to use string member function string::c_str
it->firstreturnsstd::stringnot underlying character data. To extract that you need to use the above member function.You should use: