I have a function which shall return a char*. Since I have to concatenate some strings, I wrote the following line:
std::string other_text; // ... func((\"te
It is safe to call methods of temporary variables, but not safe to return a char* of a temporary variable for later use.
This char* points to a buffer that will be freed soon. Once it is freed you will have a pointer to an invalid region in memory.
Instead please return an std::string object.