antonio.r.tome
24th February 2006, 15:14
Hi,
I'm trying to get a integer from a QByteArray.
After scaning the documentation I would say that the fowlloing piece of code should work:
-----------
int ntime;
QByteArray stderr1 ("10");
QBuffer buffer(&stderr1);
buffer.open(QIODevice::ReadOnly);
QDataStream in(&buffer);
in >> ntime;
printf("Output value %d\n",ntime);
-------------
I would expect the output :
Output value 10
but the Output is instead:
Output value 0
what am I doing wrong?:confused:
best regards
António Tomé
I'm trying to get a integer from a QByteArray.
After scaning the documentation I would say that the fowlloing piece of code should work:
-----------
int ntime;
QByteArray stderr1 ("10");
QBuffer buffer(&stderr1);
buffer.open(QIODevice::ReadOnly);
QDataStream in(&buffer);
in >> ntime;
printf("Output value %d\n",ntime);
-------------
I would expect the output :
Output value 10
but the Output is instead:
Output value 0
what am I doing wrong?:confused:
best regards
António Tomé