We use std::string to hold network messages, but students need to access to the underlying character array and cast pointers in order to do anything. The only benefit to using an std::string is in memory management. Is there a better way to do this?
Here is a function header for reference:
std::string EncodeNetworkMessage(MESSAGE_TYPE type, std::string * payload)
We use std::string to hold network messages, but students need to access to the underlying character array and cast pointers in order to do anything. The only benefit to using an std::string is in memory management. Is there a better way to do this?
Here is a function header for reference: