如何使用FILE *写入内存缓冲区? [英] How to write to a memory buffer with a FILE*?

查看:68
本文介绍了如何使用FILE *写入内存缓冲区?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么方法可以将内存缓冲区创建为FILE *。在TiXml中,它可以将xml打印到FILE *,但我似乎无法使其打印到内存缓冲区。

Is there any way to create a memory buffer as a FILE*. In TiXml it can print the xml to a FILE* but i cant seem to make it print to a memory buffer.

推荐答案

有是将内存用作 FILE 描述符的POSIX方法: fmemopen open_memstream ,具体取决于您要使用的语义: fmemopen与open_memstream之间的差异

There is a POSIX way to use memory as a FILE descriptor: fmemopen or open_memstream, depending on the semantics you want: Difference between fmemopen and open_memstream

这篇关于如何使用FILE *写入内存缓冲区?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆