LibC: Add ungetc() and automatically flush streams on fclose().

This commit is contained in:
Andreas Kling 2019-03-27 01:40:55 +01:00
commit d1e55fb4d9
Notes: sideshowbarker 2024-07-19 14:56:05 +09:00
7 changed files with 39 additions and 3 deletions

View file

@ -7,6 +7,8 @@
#include <stdarg.h>
#include <limits.h>
#define BUFSIZ 1024
__BEGIN_DECLS
#ifndef EOF
#define EOF (-1)
@ -28,6 +30,8 @@ struct __STDIO_FILE {
char* buffer;
size_t buffer_size;
size_t buffer_index;
bool have_ungotten;
char ungotten;
char default_buffer[BUFSIZ];
};