Is it possible to an implement ungetc analog in the io library? I'm trying to write a wrapper for wavpack decoder and it requires ungetc function.

Hard to do, because a separate thread read to the IO buffer which has fixed size, so if you do ungetc() even just after read the buffer could be fully filled. But you can make a wrapper functions for read() and ungetc() in the plugin with one additional byte that remembers if ungetc() was used and what was the char. ungetc() is needed as a callback function to the library?

Damian Pietras - MOC developer

Yes, it's a required callback function. As for wrappers for read/write functions I had the same idea. I'll try to emulate it.