Hello everyone, I'm sorry if this had been asked but I couldn't find anything in the forum like this.

So let's say I have an array of char like this:

Qt Code:
  1. char thd[] = {0x01, 0x07, 0x02, value, 0x00, 0x6E, 0x04}
To copy to clipboard, switch view to plain text mode 

I make a Qlineedit that gets user input of an integer from 0 -> 255. For instance, the user will input 100.

How do I take that 100 and turn it into 0x64 and put that into the place of "value" to send the char array to the serial port. I've tried QString::number to convert it to int but I get stuck there because I can't figure out how to add the "0x" in front of it and add it to the array.

I will appreciate any attempt of helping. Thank you.