是否有MinGW的没有fopencookie的或fmemopen? [英] Is there no fopencookie or fmemopen in MinGW?
问题描述
我可以改用编写自定义流?
What can I use instead to write custom streams?
推荐答案
fmemopen
是POSIX标准,但不是C标准的一部分。 fopencookie的
不是任何标准的一部分;这是一个GNU功能。
fmemopen
is POSIX but not part of the C standard. fopencookie
is not part of any standard; it's a GNU function.
TMPFILE
也是一个不错的便携替代 fmemopen
。这些功能除了几乎相同 TMPFILE
往往较慢,需要 FREAD
来获取数据回来。
tmpfile
makes a good portable replacement for fmemopen
. These functions are nearly identical except that tmpfile
tends to be slower and requires fread
to get the data back out.
在一般情况下,如果你可能需要您的输出去的地方以外的文件时,最好不要写code,需要一个 FILE *
而是支持自定义输出回调或东西。
In general, if you might need your output to go somewhere other than a file, it's best not to write code that takes a FILE *
but instead supports custom output callbacks or something.
这篇关于是否有MinGW的没有fopencookie的或fmemopen?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!