缓冲输出的小问题
c
#include <stdio.h>
int main(void)
{
int c = 0;
static char buf[1];
setbuf(stdout, buf);
while(c != EOF) {
printf("start\n");
c = getchar();
putchar(c);
printf("end\n");
}
return 0;
}
// 为什么不管输入什么 都不输出?
[解决办法]
void setbuf ( FILE * stream, char * buffer );
buffer
User allocated buffer. Shall be at least BUFSIZ bytes long. Alternatively, a null pointer can be specified to disable buffering