开发者

convert from char to hex in C++

开发者 https://www.devze.com 2023-03-09 09:25 出处:网络
I\'m doing a C++ program with a function that only accept input data in the format \\x1A\\x2B\\x3C\\x4D\\x5E\\x6F

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

精彩评论

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

关注公众号