If someone could explain how this works and if it the best way to go about doing it this way it would be great.
Is it the best way? No. Formatting the string correctly in the first place would be better/faster/easier.
Inserting spaces did not fix my problem. Like most of my programming it now works by accident. I have no idea yet why it this works, but it does:
itoa(tmpred_value, red_value, 10);
sprintf(red_value, "%3d ", tmpred_value);