C语言函数—setcbrk

函数名

setbuf

功 能

把缓冲区与流相联

用 法

void setbuf(FILE *steam, char *buf);

程序例

#include <stdio.h> 

/* BUFSIZ is defined in stdio.h */ 
char outbuf[BUFSIZ]; 

int main(void) 
{ 
   /* attach a buffer to the standard output stream */ 
   setbuf(stdout, outbuf); 

   /* put some characters into the buffer */ 
   puts("This is a test of buffered output.nn"); 
   puts("This output will go into outbufn"); 
   puts("and won't appear until the buffern"); 
   puts("fills up or we flush the stream.n"); 

   /* flush the output buffer */ 
   fflush(stdout); 

   return 0; 
} 
  
  

如果引用本站的原创文章,请注明原文链接:,本站保留追究责任的权利!