Question answered, thanks to all!
This is because printf("%s")
expects a C-style string, not std::string
To fix it
-
Use cout as it is much safer than printf, and can handle your own types (if you have overloaded
operator<<
forstd::ostream
) -
Or if you want to do it using printf, you can do
A[5].c_str()
to obtain C-style string.printf("%s", (*it).second.c_str()); //works
2 Likes
So we have the answer, but not the question… What was it ?
1 Like