[SOLVED] save value of qint16 to qint8



  • i have a lineedit.
    @qint16 moduliINT
    moduliINT=ui->lineEdit_2->text().toInt(&result,10);@
    in moduliINT I have value converted to decimal
    Now, I have a structure:
    @typedef struct {
    unsigned char moduli;
    } _PROTEZ;@

    @_PROTEZ prot@

    I want to save the value of moduliINT in port.moduli.

    but moduliINT is 2 bytes, while prot.moduli is 1 byte.

    @prot.moduli=(char)moduliINT;@

    I did so but it does not work.

    how can I do?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.