since this is obvious c++ program why not just make the parameter a std::string object instead of char*. That way you can remove the strcpy(), get rid of temp string, and simplify the function. I assume err_msg will always be longer than 25 characters
Code:void UdpServer::InsertIn2DB(std::string err_msg){ Socket2DB<<err_msg.c_str(); // substr yapilacak burda err_msg=err_msg.substr(25); }