title: Input/output stream abstraction layers for plain C
body: <p>Are there any widely used I/O stream abstraction layers for plain C?</p>
  
  <p>By an I/O stream abstraction layer I mean any layer that at least allows the creation of custom read/write functions. For C++, there's the standard iostream and boost::iostreams. For glibc users, there's a possibility to use custom streams. These won't do any good if the requirement is to write portable C code.</p>
  
  <p>It is better to use a library that is either widely used or easy to embed to the source code, or both.</p>
  
  <p>SDL_RWops is an undocumented but widely used feature of SDL, and zziplib can use it. However, it does not make much sense to add a dependency to SDL just to get this feature.</p>
  
  <p>GLib contains a GIOChannel abstraction, but the library is again quite large and they say that "support for Windows is only partially complete".</p>
  
  <p>However, the above are not quite satisfactory for small libraries, such as decoders, file format readers and signal processors: they contain lots of unnecessary stuff and the LGPL licensing prevents embedding the relevant parts to non-GPL code.</p>