Hi,
My problem is that the value of mpCurrent gets lost after the program leaves the function. How shall I do the assignment? Thanks!
private:
Motors_t * mpCurrentMotors;
MotorPosition::setPosition( MotorPosition_t ** ppositions )
{
Motors_t* motors_ = new Motors_t();
for(int i = 0; i< MAX_NUM_MOTORS; i++)
{
motors_->mpMotor[i] = new Motor(i);
motors_->mpMotor[i]->setPosition( ppositions[i]->mMotorCount);
}
motors_->index = ++ mLastIndex;
mpCurrent = motors_;
}
You have to store it in mpCurrentMotors at some point.
Sorry copy mistake.
The function sais:
it is:
Motors_t * mpCurrent;
Again, as soos as I leave the function the value I set got lost.