I'm trying to cast qint16 (int16) to double with mydouble = (double) myInt16; and I get
error: invalid cast from type 'qint16* {aka short int*}' to type 'double'
How can I convert a int16 to double ?
I'm trying to cast qint16 (int16) to double with mydouble = (double) myInt16; and I get
error: invalid cast from type 'qint16* {aka short int*}' to type 'double'
How can I convert a int16 to double ?
Based on the code you've shown, you don't have an int. You have a pointer to an int. Dereference it, as follows:
// Assume src points to a short int
double mydbl = *src;
The conversion from integer to double will be automatic, but you have to dereference the pointer.
From the error, myInt16 is a pointer to short int. So simply use:
double mydouble = *myInt16;
And the short int will automatically be promoted to double.