データを16バイトのセットにコピーする必要があります。簡単な方法でそれを行うにはどうすればよいですか?以下のアルゴリズムを思いついたのですが、ヌルターミネータが追加されているかどうかをどうやって知ることができますか?ありがとう!:)
std::string input
//get message to send to client
std::cout << "Enter message to send (type /q to quit) : ";
getline(std::cin, input);
input += '\n';
const char *data = input.c_str();
len = strlen(data)+1;
int max_len =17;
//split msg into 16 bytes
for(int i = 0; i < len ; i+=max_len)
{
char tempStr[max_len];
//get next 16 bytes of msg and store
for(int j = 0; j < max_len ; j++)
{
tempStr[j] = data[j+i];
}//end of for loop
//Do some stuff to tempStr
}