hi,
I'm wanting to find out a way to display/convert a whole char array or string into int, such that their hex values are displayed & not characters. I know how to do this, but I'm wanting to find out if there's a way to do it in one pass & not byte by byte
For example, the following does it one at a time, which is fine for small strings, but not for large data blocks.
Code:char Temp[32]; unsigned char* pbuffer = somedata; string str; for(int i=0; i< Charsize;i++) { sprintf(Temp,"%02x ",pbuffer[i]); str +=Temp; }
I'm after more something like this:
Where this would convert & store int values in one go into szString or something like along these lines.Code:unsigned char *pbuffer = "The quick brown fox jumps over the lazy dog"; std::string szStringConvert2Int(pbuffer);



LinkBack URL
About LinkBacks



