At the start of the function, keep a copy of the frontbuffer in a temporary buffer.
When the loop starts, you copy this to the backbuffer, and after that, you write the current string to the backbuffer. Then you can flip the front and the backbuffer.
When the function ends, discard the temporary buffer.
Something like that should work.
When the loop starts, you copy this to the backbuffer, and after that, you write the current string to the backbuffer. Then you can flip the front and the backbuffer.
When the function ends, discard the temporary buffer.
Something like that should work.