'Convert Python BytesIO to C FILE object
I have a C library that is wrapped using Cython. Some functions of the C library are using FILE objects internally which are being worked on with fseek, fputc, etc. Currently the function retrieves a file name and opens it via fopen, which returns a FILE object.
However, in some occasions I want to pass a Python StringIO or BytesIO stream to the function to prevent having to write data to the hard drive.
Is there any way to convert a Python BytesIOto a C-style FILE object and/or "emulate" the intertface without having to do a major rewrite of the C library?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
