Use open_buffer() instead of non-portable open_memstream()