Using file stream and open_memstream as the output buffer