First, I have the following typedefs :
typedef unsigned char BYTE;
typedef unsigned short WORD;
Then, I have a function in class A, which calculates a value with the type WORD
:
class A {
...
private:
WORD calculatedData;
...
void calculateCanData()
{
...
calculatedData = calcCrc();
B::setCanData(m_canId, &calculatedData, sizeof(calculatedData) );
}
}
In class B, I have the setData()
function with the following interface:
void B::setCanData(WORD canId, BYTE * data, int length)
Now, I can't send a WORD
at once, so I guess I need to somehow split the WORD
into two BYTEs and the pass them as parameters to the function?
Or is there a better solution?