Say I have this:
QString mystring = "67 49 213 59";
int a, b, c, d;
Is there a Qt alternative to sscanf so I can read the numbers into the int
variables?
QTextStream
provides the equivalent of the standard library's streams.
Don't forget that the text stream should be destroyed before the string.
QString mystring = "67 49 213 59";
QTextStream myteststream(&mystring);
int a = 0, b = 0, c = 0, d = 0;
myteststream >> a >> b >> c >> d;
int a, b, c, d;
QString s("67 49 213 59");
QTextStream(&s) >> a >> b >> c >> d;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With