libc: Implement setbuf(), setbuffer(), and setlinebuf()
Some checks failed
continuous-integration/drone/pr Build is failing
Some checks failed
continuous-integration/drone/pr Build is failing
These are all simple wrappers around setvbuf().
This commit is contained in:
parent
77022abafd
commit
f704739a7c
@ -191,6 +191,15 @@ extern "C"
|
|||||||
/* Change a file's buffering mode and internal buffer. */
|
/* Change a file's buffering mode and internal buffer. */
|
||||||
int setvbuf(FILE* stream, char* buf, int mode, size_t size);
|
int setvbuf(FILE* stream, char* buf, int mode, size_t size);
|
||||||
|
|
||||||
|
/* Change a file's internal buffer. */
|
||||||
|
void setbuf(FILE* stream, char* buf);
|
||||||
|
|
||||||
|
/* Change a file's internal buffer. */
|
||||||
|
void setbuffer(FILE* stream, char* buf, size_t size);
|
||||||
|
|
||||||
|
/* Change a file's buffering mode to line buffered. */
|
||||||
|
void setlinebuf(FILE* stream);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -729,4 +729,19 @@ extern "C"
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setbuf(FILE* stream, char* buf)
|
||||||
|
{
|
||||||
|
setvbuf(stream, buf, buf ? _IOFBF : _IONBF, BUFSIZ);
|
||||||
|
}
|
||||||
|
|
||||||
|
void setbuffer(FILE* stream, char* buf, size_t size)
|
||||||
|
{
|
||||||
|
setvbuf(stream, buf, buf ? _IOFBF : _IONBF, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void setlinebuf(FILE* stream)
|
||||||
|
{
|
||||||
|
setvbuf(stream, NULL, _IOLBF, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user