He often noticed that I could effectively solve practical problems in C if there was a way to create a virtual one FILEand attach the necessary callbacks for events such as buffer filling, query input, closing, and flushing. Then it should be possible to use most of the functions stdio.h, for example. fprintfwithout changes. Is there an environment to do this? If not, is this possible with minimal effort, at least on some platforms?
Possible applications:
- Writing or reading from a dynamic or static region of memory.
- For parallel recording of multiple files.
- For reading from a stream or sharing data.
- Applying a filter to another (virtual or real)
FILE. - Support for file formats with indirectness (for example,
#include). - Preprocessor C (?).
I'm less interested in solutions for specific cases than in frameworks that allow you to use your own FILE. I am also not looking for a virtual file system, but rather a virtual FILE*one that I can transfer to a CRT.
To my disappointment, I had never seen anything like it; as far as I can see, C11 believes that it FILEdepends entirely on the language developer, which is probably reasonable if you want the language specifications (+ library) to be small, but sad when compared to Java input / output streams.
, FILE () C, , , , , , . . , , , . , , , , , , - .
, , , FILE s, ; , , , , .
a-reader-interface-that-consumes-files-and-char-in-c, FILE; , fmemopen, .