https://sourceforge.net/projects/synergy-stable-builds/files/v1.8.8-stable/
#include <iostream> #include <iomanip> #include <stdexcept> static std::string hexEncode (std::string const& str) { std::ostringstream oss; for (size_t i=0; i < str.size(); ++i) { int c = str[i]; oss << std::setfill('0') << std::hex << std::setw(2) << std::uppercase; oss << c; } return oss.str(); } int main() { std::ostringstream oss; oss << "{v1.10.0;pro;Y;5;[email protected];Y Computer;0;0}"; std::cout << hexEncode(oss.str()); } |