I am trying to write a Fopen statement like this:
fp = fopen("client." + receiver->get_identifier().c_str() + ".vol", "a+");
const char*, not a
operator+ cannot kick in (one argument of it must be a
std::string). Removing the
c_str() and converting at the end with
std::string::c_str() should do the trick
fopen(("client." + receiver->get_identifier() + ".vol").c_str(), "a+");
This is because you'd have a
const char* plus a
operator+ will work.
If you may wonder why one cannot define an
const char*s, that's because C++ does not allow operator overloading for fundamental types; at least one argument must be of a user-defined type.