w*s 发帖数: 7227 | 1 the code is like this,
std::stringstream ss;
unsigned char *pBuf;
ss << hex << int(pBuf[i]);
cout << ss.str();
say i have 3 chars, 14, 0, 54.
i got this 14054 instead of 140054,
how to make it print 140054 ?
tried setw(2), didn't work. | t****t 发帖数: 6806 | 2 setfill('0')
and setw() has to be used before each data.
【在 w*s 的大作中提到】 : the code is like this, : std::stringstream ss; : unsigned char *pBuf; : ss << hex << int(pBuf[i]); : cout << ss.str(); : say i have 3 chars, 14, 0, 54. : i got this 14054 instead of 140054, : how to make it print 140054 ? : tried setw(2), didn't work.
| d**********x 发帖数: 4083 | 3 The best answer: do not use this freaky thing...
【在 w*s 的大作中提到】 : the code is like this, : std::stringstream ss; : unsigned char *pBuf; : ss << hex << int(pBuf[i]); : cout << ss.str(); : say i have 3 chars, 14, 0, 54. : i got this 14054 instead of 140054, : how to make it print 140054 ? : tried setw(2), didn't work.
| w*s 发帖数: 7227 | 4 works, thanks a lot !
now i need to worry about BigInt in perl.
【在 t****t 的大作中提到】 : setfill('0') : and setw() has to be used before each data.
|
|