开发者

convert from char to hex in C++

I'm doing a C++ program with a function that only accept input data in the format

\x1A\x2B\x3C\x4D\x5E\x6F

but the output of the previous function is a string of characters:

1A2B3C4D5E6F

How can I change the cha开发者_如何转开发racter string 1A2B3C4D5E6F to \x1A\x2B\x3C\x4D\x5E\x6F so that I can use it as the input for another function?


You could use sprintf for getting strings in the format that you want. You can read-up on this function here.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜