> myClass::saveFieldx()
> {
> Byte m_x = 50;
> Long offset_to_x = 6;
>
> DmWrite( m_src, offset_to_x ,&m_x , sizeof( m_x));
> }

why is the offset hardcoded?


> I am actually stepping through the code and checking the value of v_src
> before and after the DmWrite call. If src->m_x starts out as 5, and then I
> do a DmWrite to set it to 50, the value ends up 0.

are you using the View Memory window of the debugger to look at m_src before
executing DmWrite, and then compare the memory afterwards?  as with any
debugger, compiler optimizations can confuse the debugger if you're just
looking in the variables window.


> Sorry, I can't post the real code. Have you actually done this with
> CW R6 in C++ member function?

no, but that's irrelevent.  using C or C++ is not going to alter the
behavior of DmWrite.

if you look at the source to DmWrite, i think you can convince yourself the
problem is definitely not in DmWrite.  if you can't post your code, you'll
probably need to do some careful debugging of your app to figure out what's
going wrong.

one sanity check you might want to make, is to verify that sizeof(m_x)
really does == 1.  perhaps this is an alignment issue within classes?  (i'm
assuming that "m_x" is really a member variable, not a local variable).


Reply via email to