Graph readers/writers use FILE *
handles. It would be useful to introduce a more flexible interface (based on buffers and perhaps callback functions to refill those buffers) that can be hooked up to any stream, not just files. The goal is to make it possible to hook up igraph to a host language’s native streams without having to resort to ugly hacks such as temporary files.
It turns out that on Linux and macOS it is possible to create fully customized FILE *
objects, backed by whatever you like. The functions are fopencookie()
(a GNU extension) and funopen()
(a BSD extension). I was not able to find anything comparable for Windows though. If we could find a solution then we could keep the FILE *
interface and just document how to hook it up to arbitrary streams on various platforms.