When executing this function, an error occurs:

no matching function for call to 'std::map<std::basic_string<char>, char>::insert(std::pair<std::basic_string<char>, std::basic_string<char> >)' 

The code itself:

 void inital() { char buff[100]; ifstream fin("cmd.txt"); int strnum = 0; char end[] = "#STOP"; map <string, char> cmd; while(strcmp(buff, end) != 0) { std::cmatch result; std::regex my_regex("^PRG (.+) CMD ([az][0-9]+)$"); if (std::regex_match(buff, result, my_regex ) ) { cmd.insert(make_pair(result[2].str(),result[1].str())); } fin.getline(buff, 100); strnum++; } fin.close(); } 

    1 answer 1

    Well so everything is correct, read the messages of the compiler, it does not say a garbage.

     map <string, char> cmd; cmd.insert(make_pair(result[2].str(),result[1].str())); 

    You have type char and you pass a string there. Write already result[1].str()[0] or something like that.