Hi there,
I am using the STL map and I print the map using:
map <string, float> ngram_token_index ;
map <string, float>::iterator map_iter ;
//read the map
...
// print the map
for ( map_iter = ngram_token_index.begin() ; map_iter != ngram_token_index.end() ; map_iter++ )
cout << map_iter->first << " => " << map_iter->second << endl;
While this works, I want to copy the value in map_iter->first to a string variable.
The code
char str[1024] ;
strcpy(str, map_iter->first) ;
gives the following error:
error: cannot convert 'const std::basic_string<char, std::char_traits<char>, std::allocator<char> >' to 'const char*' for argument '2' to 'char* strcpy(char*, const char*)'
I am new to STL. Any help would be greatly appreciated.
Thanks,
J.