Since ObjC is a superset of C, all you have to do is #import/#include <stdio.h> to access funopen() which itself contains the functions readfn , writefn , seekfn and closefn . And fwopen, which has an example showing how to write to two streams with this other SO question .
Mac OSX and iOS do not include fmemopen and open_memstream because they are clearly not portable linux functions
Starting with macos 10.13, ios 11.0, tvos 11.0 and watchos 4.0, fmemopen and open_memstream are available in stdio, as well as several other useful standard POSIX.1-2008 functions.
source share