提交 e7218008 编写于 作者: R Rich Felker

add more legacy functions: setlinebuf and setbuffer

上级 8b61c816
...@@ -156,6 +156,8 @@ char *cuserid(char *); ...@@ -156,6 +156,8 @@ char *cuserid(char *);
#define off64_t off_t #define off64_t off_t
int asprintf(char **, const char *, ...); int asprintf(char **, const char *, ...);
int vasprintf(char **, const char *, va_list); int vasprintf(char **, const char *, va_list);
void setlinebuf(FILE *);
void setbuffer(FILE *, char *, size_t);
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
......
#include "stdio_impl.h" #include <stdio.h>
void setbuf(FILE *f, char *buf) void setbuf(FILE *f, char *buf)
{ {
......
#define _GNU_SOURCE
#include <stdio.h>
void setbuffer(FILE *f, char *buf, size_t size)
{
setvbuf(f, buf, buf ? _IOFBF : _IONBF, size);
}
#define _GNU_SOURCE
#include <stdio.h>
void setlinebuf(FILE *f)
{
setvbuf(f, 0, _IOLBF, 0);
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册