I'm writing a networking application using sockets in c++ so lets jump straight to the problem : i'm storing my data as an array of int16_ts (the choice of int16_t being for consistency accross different platforms) , as we know each of these int16_ts would be two consecutive bytes in memory. i want to store each of those bytes in a char so that each int16 would be translated to exactly two bytes and eventually send the entire char* over the socket
please notice that i'm not looking for something such as std::to_string cause i want each int16_t to occupy exactly two bytes.
any help is appreciated !