Qdebug display hex value

前端 未结 9 1470
你的背包
你的背包 2021-02-19 02:56

I am trying to display a number using QDebug in the Hex format. Below is the code which I have written. It is working but the output has string contents enclosed in double quot

9条回答
  •  独厮守ぢ
    2021-02-19 03:39

    If one is not tied to use streaming operators, can go with the plain old %x and use qDebug with formatting string:

    int hexnum = 0x56;
    qDebug("My hex number is: %x", hexnum);
    

    which will yield "My hex number is: 56", without quotes.

提交回复
热议问题