|
Re: malloc?
I believe what you're looking for is a buffer. You statically allocate a char array, and have an index showing the next place to write a character.
Also, if you want to get fancy, you can loop the buffer around--a ring buffer. So when you reach the end of the buffer, you start at the beginning. This is very eficiently done when your buffer size is a power of two. (index &= 0x1FF)
Just some thoughts.
|