Not familiar with m_nMode, is it just by setting the variable normally? ”m_nMode = 0”
nope.
Hey There!
Please login and(or) register to see this awesome content today.
Serialize is just a way to store/retrieve some values into/from a CAr passed by reference. Is a way to facilitate writing/reading data in a CAr. Something that you have already implemented correctly in your struct
Note that this implementation makes a call to
ar.IsStoring() to know whether it is writing or reading data to the CAr
Hey There!
Please login and(or) register to see this awesome content today.
m_nMode automatically defined when creating the CAr..:
Hey There!
Please login and(or) register to see this awesome content today.
When we declare a new CAr (usually called ar) inside a function, or use the macros BEFORESENDDUAL, BEFORESENDSOLE etc, we are creating a new CAr, which will use the will be set to write mode by default and will use internal buffer m_lpBuf to store the data.
Hey There!
Please login and(or) register to see this awesome content today.
On the other side...
Hey There!
Please login and(or) register to see this awesome content today.
Could you change something in your structure to force writing? Theoretically yes, but it is not the right thing to do, after all your structure is correct.
Changing m_nMode manually should never be used, as it would probably be necessary to change the position of m_lpBufferStart , etc... in short it would probably overwrite data or change the correct position of the pointer to read remaining data.
I'm assuming you've already written in your strTitle the title you want to receive, so, what
may be happening is that you are using a CAr that is in reading mode (which was started with a buffer received from somewhere), and not a new CAr to write the data.
If you can/want, post the parts where you create and send the package, as well as the parts where you process it back.Because, your struct EQUIP_SWITCH seems to be correct to me, with a correct implementation of serialize and initialization of strTitle as an empty string.