diff options
Diffstat (limited to 'src/stdio/setbuf.c')
-rw-r--r-- | src/stdio/setbuf.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/stdio/setbuf.c b/src/stdio/setbuf.c new file mode 100644 index 00000000..351db3d3 --- /dev/null +++ b/src/stdio/setbuf.c @@ -0,0 +1,24 @@ +#include <stdio.h> + +/** specify file stream buffer **/ +void setbuf(FILE * restrict stream, char * restrict buf) +{ + if (buf) { + setvbuf(stream, buf, _IOFBF, BUFSIZ); + } else { + setvbuf(stream, NULL, _IONBF, 0); + } +} + +/*** +sets the buffer for ARGUMENT(stream) to ARGUMENT(buf). The buffer must hold +at least CONSTANT(BUFSIZ) characters. It is the equivalent of: + LITERAL(setvbuf(stream, buf, _IOFBF, BUFSIZ);) + +If ARGUMENT(buf) is CONSTANT(NULL), ARGUMENT(stream) will become unbuffered. It is the +equivalent of: + LITERAL(setvbuf(stream, NULL, _IONBF, 0);) +***/ +/* +STDC(1) +*/ |