I am facing the following issue:
I am succesfully reading raw bytes from a Qserialport but cannot find how
to manipulate these bytes on a binary basis.
I tried several format from QBytearray to QDatastream but can never apply a
binary operator (NOT,OR,AND) to the bytes received.
Thks in advance for your coop,
@jipe3001 Can you show your code? How did you try to apply binary operators?
To make my request simpler:
let's say I declare a variable value as follows:
How can I manipulate this variable with binary operators ?
since qint8 is typedef for signed char, do you mean
qint8 andVal = value & 0x000111; qint8 orVal = value | 0x10101010; qint8 notVal = ~value;
qint8 value = 0x00; value |= 0x01; // sets the lowest bit to 1 value &= 0xFE; // sets lowest bit to 0 value = ~value;
sorry you a right, I tried to make the point clear
Thanks to both of you, it works perfectly,
great support !!