C++ (Qt)float ReadIncorrect( QFile & file ){ short temp[2]; file.readData((char *) temp, 4); return qFromBigEndian(temp[0]) + qFromBigEndian(temp[1]) / 10000.0f;}
ushort time_sec = QString("%1").arg(qToBigEndian(sec),0,16).toUShort(); ushort time_msec = QString("%1").arg(qToBigEndian(msec),0,16).toUShort(); float rez = time_sec+time_msec*0.0001;
C++ (Qt)inline short Hex2Dec( short val ){ val = qFromBigEndian(val); short sum = 0, bias = 1; for (int i = 0; i < 4; ++i) { sum += (val & 0xF) * bias; bias *= 10; val >>= 4; } return sum;} float ReadStrangeFloat( QFile & file ){ short temp[2]; file.readData((char *) temp, 4); return Hex2Dec(temp[0]) + Hex2Dec(temp[1]) / 10000.0f;}
C++ (Qt) static float convert(QFile *file){ QDataStream in(file, QIODevice::ReadOnly); in.setByteOrder(QDataStream::BigEndian); quint16 v1 = 0; quint16 v2 = 0; in >> v1 >> v2; const QString s = QString("%1.%2").arg(v1).arg(v2); return s.toFloat();}
C++ (Qt)... const QString s = QString("%1.%2").arg(v1).arg(v2);...
C++ (Qt)static float convert(QFile *file){ QDataStream in(file, QIODevice::ReadOnly); in.setByteOrder(QDataStream::BigEndian); quint16 v1 = 0; quint16 v2 = 0; in >> v1 >> v2; return v1 + (v2/10000.0);}