But there's no problem with fprintf and fflush if the filehandle is STDOUT, or STDERR, or is attached to a regular file.
Why should they be a problem when the filehandle is attached to a "memory file" ?
In any case, the function that's doing the fprintf/fflush is a 3rd party library function which I'm not going to modify.
I'm not in desperate need of getting this to work ... I just thought it was odd, and am still interested to know the cause of the problem.