I write to my serial device with hexadecimal represented as data = "\x35\x0d"
(which is 5 and a carriage return) using this code:
boost::asio::write(
*serial_port,
boost::asio::buffer(data.c_str(), data.size()),
boost::asio::transfer_at_least(data.size()),
error
);
How could I convert the string "350d" to a byte string for use in writing to my serial port? Not all of my commands will be hard coded. Thank you.