这就是我想要做的:
int x = 0;
char toBuffer;
while (twenty_byte_buffer[x] != '\0') // While the string isn't at the end...
{
cout << int(twenty_byte_buffer[x]); // show me, works fine
//need to concat the int values from above into toBuffer as a string
//eg. "-62-8711097109" would have derived from this "©nam"
//this doesn't work:
//strcat ( toBuffer, reinterpret_cast<*????*>(twenty_byte_buffer[x]) );
x++;
}
Run Code Online (Sandbox Code Playgroud)
任何帮助将不胜感激!
用一个stringstream.它的工作方式如下cout:
stringstream sstr;
while (twenty_byte_buffer[x] != '\0')
{
sstr << int(twenty_byte_buffer[x]);
x++;
}
string result = sstr.str();
Run Code Online (Sandbox Code Playgroud)