Thank's I thought of doing it that way.
I just want to know if there are a way like int std c++ one can use std::stringstream and read it in the way I tried to with Qt.
Thank's I thought of doing it that way.
I just want to know if there are a way like int std c++ one can use std::stringstream and read it in the way I tried to with Qt.
Hi,
Using QTextStream you can't because all is text, so then you have to parse the data.
Òscar Llarch i Galán
If one look at the example in the manual. I thought it would work that way.
By default, when reading numbers from a stream of text, QTextStream will automatically detect the number's base representation. For example, if the number starts with "0x", it is assumed to be in hexadecimal form. If it starts with the digits 1-9, it is assumed to be in decimal form, and so on. You can set the integer base, thereby disabling the automatic detection, by calling setIntegerBase(). Example:
QTextStream in("0x50 0x20");
int firstNumber, secondNumber;
in >> firstNumber; // firstNumber == 80
in >> dec >> secondNumber; // secondNumber == 0
char ch;
in >> ch; // ch == 'x'
Bookmarks