[C] 把缓冲区与流相联 →→→→→进入此内容的聊天室

来自 , 2019-11-25, 写在 C, 查看 110 次.
URL http://www.code666.cn/view/6211080f
  1. #include <stdio.h>
  2.  
  3. /* BUFSIZ is defined in stdio.h */
  4. char outbuf[BUFSIZ];
  5.  
  6. int main(void)
  7. {
  8.    /* attach a buffer to the standard output stream */
  9.    setbuf(stdout, outbuf);
  10.  
  11.    /* put some characters into the buffer */
  12.    puts("This is a test of buffered output.\n\n");
  13.    puts("This output will go into outbuf\n");
  14.    puts("and won't appear until the buffer\n");
  15.    puts("fills up or we flush the stream.\n");
  16.  
  17.    /* flush the output buffer */
  18.    fflush(stdout);
  19.  
  20.    return 0;
  21. }
  22.  

回复 "把缓冲区与流相联"

这儿你可以回复上面这条便签

captcha