已关闭。此问题为opinion-based。当前不接受答案。
**想要改进此问题吗?**请更新问题,以便editing this post可以使用事实与引用来回答.
13天前关闭。
Improve this question
最近我发现了两个函数setbuf()
和setvbuf()
可以用来设置流缓冲区。setvbuf
这个名字中的字母v
是什么意思?是various
、version
还是别的什么?
已关闭。此问题为opinion-based。当前不接受答案。
**想要改进此问题吗?**请更新问题,以便editing this post可以使用事实与引用来回答.
13天前关闭。
Improve this question
最近我发现了两个函数setbuf()
和setvbuf()
可以用来设置流缓冲区。setvbuf
这个名字中的字母v
是什么意思?是various
、version
还是别的什么?
2条答案
按热度按时间6xfqseft1#
我没有找到任何关于“v”的解释,但我猜它可能是“变量”,因为它允许指定缓冲区的大小和模式。
svmlkihl2#
V可以是变量,也可以是值,这要看上下文。我们知道setbuf()函数没有返回值,所以unix系统设计者给了v(value)来区分setvbuf()和setbuf()。这个函数成功返回零,否则返回非零值。请看下面的说明。
1. IBM公司
一般描述控制指定流的缓冲策略和缓冲区大小。流指针必须指向打开的文件,并且setvbuf()必须是对文件的第一个操作。
https://www.ibm.com/docs/en/zos/2.2.0?topic=functions-setvbuf-control-buffering
2.信息(汉堡)
说明:
使用setvbuf指定要为fp标识的文件或流指定哪种缓冲,方法是使用以下值之一(来自stdio.h)作为mode参数:
https://users.informatik.haw-hamburg.de/~krabat/FH-Labor/gnupro/4_GNUPro_Libraries/a_GNUPro_C_Library/libcsetvbufspecify_file_or_stream_bu.html