The counter is an EXCELLENT idea! However, instead of initializing at zero, how about initializing at the buffer length. On putting something in the buffer, decrement it. On taking something out, increment it. The counter then indicates how much room is left in the buffer. If you've got a string to stick in the buffer, you now know whether it will fit before starting to stuff it in the buffer. Harold FCC Rules Online at http://www.hallikainen.com -- David VanHorn wrote: > >To check to see if there's anything in the buffer, compare the input and output pointers. They are the same if the buffer is empty. > >To see if the buffer is full, read the output pointer, add 1 (and if it ran off the end of the buffer, set the result back to the start of the buffer), and compare this result with the input pointer. If they are equal, the buffer is full. when i did this, i found it simpler and faster to maintain a byte count. put incs it, and get dec's it. for fullness, compare to the length of the buffer. >For even more fun, write a dynamic buffer that goes and gets more ram when needed, and releases it when it's not needed. We did this in Turbo Pascal for a system where we needed LOTS of variable sized buffers. that, i've not tried yet. ________________________________________________________________ The best thing to hit the internet in years - Juno SpeedBand! Surf the web up to FIVE TIMES FASTER! Only $14.95/ month - visit www.juno.com to sign up today! -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics