| ??? 05/22/02 20:27 Read: times |
#23280 - RE: circular buffers by pointers or index ? |
what i need to do is a circular buffer double the size of my message which is 18 bytes long.
the newly comming bytes beeing written with the head pointer while the read bytes increment the tail pointer. If the head pointer catches the tail pointer i need to increment the tail pointer to actually overwrite the tail pointer with no error message. It looks messy when the the head pointer is at the begining of the buffer and the tail at the end. is there a good way of doing it in C or do i have to include lots of ifs and buts statements ? i would have thought its very easy implementing this with pointers rather than indexex. My boss is a programmer and he has allergy to assembly so he wants me to write the code in c for portability and for him to understand it! |



