I want to read hex data from a QTextStream
Qt Code:
  1. #include <QTextStream>
  2. int main(int, char**) {
  3. QString string("hexvalue 7C00 15");
  4. QTextStream in(&string);
  5. in.setIntegerBase(16);
  6. QString str1, str2;
  7. unsigned int val1;
  8. in >> str1 >> val1 >> str2;
  9. qDebug("%s %x %s", qPrintable(str1), val1, qPrintable(str2));
  10. return 0;
  11. }
To copy to clipboard, switch view to plain text mode 
This program outputs
Qt Code:
  1. hexvalue 0 C00
To copy to clipboard, switch view to plain text mode 
I thought that setIntegerBase(16) tells the stream to expect hex input when reading integers. The read stops on the character C, whic becomes p[art of a following string.

Can I read a hex value without reading a string and then converting and without a 0x prefix ?
All ideas welcome

Enno