The trouble I'm having is when the value of 'a' goes from 4 digits to 3, 2 or 1 digit the output associated with variable 'b' shifts to the left leaving a 'shadow' of the previous output on the screen.

the statement,

fprintf(_H_USER, "\nP: %dW Acc: %dWh", P,Acc);

displays,

P: 1234W Acc: 12Wh

then,

P: 987W Acc: 14Whh

and,

P: 65W Acc: 15WhWh

If anyone reading this knows how to set the width of INT P to four digits, I would be very grateful for some direction.

Thanks