headers/bsd: Add sys/queue.h.
[haiku.git] / src / system / libroot / posix / stdio / fpurge.cpp
blobe007ffac322128dddda216548c1109a7f2486615
1 /*
2 * Copyright 2008, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
4 */
6 #include <libio.h>
7 #include <stdio_ext.h>
8 #include <stdlib.h>
11 int
12 fpurge(FILE* stream)
14 // purge read and write buffers
15 stream->_IO_read_end = stream->_IO_read_ptr;
16 stream->_IO_write_ptr = stream->_IO_write_base;
18 // free ungetc buffer
19 if (stream->_IO_save_base != NULL) {
20 free(stream->_IO_save_base);
21 stream->_IO_save_base = NULL;
24 return 0;
28 void
29 __fpurge(FILE* stream)
31 fpurge(stream);