- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
setbuf
函数什么时候有用(NULL 值除外)?
我尝试发明这些例子,但我还是做不到。
我了解 setvbuf
如何发挥作用,但我不了解 setbuf
。
最佳答案
基本上,setvbuf
是一个较新的 API,其逻辑与 setbuf
相同。 setbuf
的存在是为了与 setvbuf
存在之前编写的程序兼容。
换句话说,除非您正在处理已经使用 setbuf
的代码,否则请忽略它的存在。
Function:
void setbuf (FILE *stream, char *buf)
- If
buf
is a null pointer, the effect of this function is equivalent to callingsetvbuf
with a mode argument of_IONBF
. Otherwise, it is equivalent to callingsetvbuf
withbuf
, and a mode of_IOFBF
and a size argument ofBUFSIZ
.- The setbuf function is provided for compatibility with old code; use setvbuf in all new programs.
关于c++ - setbuf 什么时候有用(除了 NULL 值)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20650861/
来自 Ubuntu 上的 man setbuf: You must make sure that the space that buf points to still exists by the ti
我正在开发一个 basic_streambuf 来处理从/到 Winsock 套接字的读取和写入。就像 basic_filebuf 一样,我在内部使用 std::codecvt 对象将从底层套接字读取
我的问题如下:Martin York this 中的 claim , this , 和 this回答可以使用 basic_stringbuf::pubsetbuf 像这样从一段内存中读取 string
这是我在 Stackoverflow 上的第一步! 因此,我尝试使用 setbuf() 将 stdout 重定向到 char buffer[BUFSIZ]。当我使用 printf() 时,它工作得很好
程序 1: #include void main() { printf("Hello\n"); } 输出: $strace ./a.out
再一次,我的老师无法回答我的问题。我知道谁能... 所以,我从来没有真正学过 C。在 C++ 中,显然,我会一直使用 cout 语句。在最近的作业中,我的老师告诉我们一定要把 setbuf( stdo
setbuf 函数什么时候有用(NULL 值除外)? 我尝试发明这些例子,但我还是做不到。 我了解 setvbuf 如何发挥作用,但我不了解 setbuf。 最佳答案 基本上,setvbuf 是一个较
将VS2005中的“setbuf”移植到VS2008需要做哪些改动? 我必须将 VS2005 中的项目修改为 VS2008 才能构建它。下面是需要在VS2008中编译的代码行。 std::ifstr
如果我想使用标识符NULL怎么办?在 gdb的调用语句? 是因为我没有在 gdb 中包含 stdio.h 吗? 我试过:call #include 但这似乎不起作用。 最佳答案 NULL是一个 C 定
Linux seq_file 接口(interface)中是否有一个setbuf(stdout, NULL) 等效函数? 据我所知,通过 setbuf(stdout, NULL),printf 函数立
我是一名优秀的程序员,十分优秀!