Can I create a memory-mapped FILE * in C/Objective-C on iOS?
Because ObjC is a superset of C, all you have to do is #import/#include <stdio.h>
to gain access to the funopen()
which in itself contains the functions readfn
, writefn
, seekfn
, and closefn
. And fwopen which has an example showing how to write to two streams at this other SO question.
Mac OSX and iOS don't include fmemopen
and open_memstream
because they are apparently unportable linux functions
As of macos 10.13, ios 11.0, tvos 11.0, and watchos 4.0, fmemopen
and open_memstream
along with a few other helpful POSIX.1-2008 standard functions are available in stdio.
Have a look at https://github.com/shyuep/pyhull/tree/master/src/fmemopen, I've tested it myself on a Mac OSX 10.8.2 and it is working ok.
Author states it should also work on iOS.