diff options
author | dzwdz | 2022-07-26 22:04:19 +0200 |
---|---|---|
committer | dzwdz | 2022-07-26 22:04:19 +0200 |
commit | 137dcb3e207b264c467f4b2b13df2316b8b0a67c (patch) | |
tree | 29f01a9c4eca62ec6b0f443d8a48eeda563df452 /src/user/lib/include | |
parent | 4d19346cf0d2a93eed9afe22e5c2a5d9a30fb37c (diff) |
user/libc: fread, fwrite, fclose
Diffstat (limited to 'src/user/lib/include')
-rw-r--r-- | src/user/lib/include/bits/file.h | 1 | ||||
-rw-r--r-- | src/user/lib/include/stdio.h | 12 |
2 files changed, 8 insertions, 5 deletions
diff --git a/src/user/lib/include/bits/file.h b/src/user/lib/include/bits/file.h index 74a8c17..e50d402 100644 --- a/src/user/lib/include/bits/file.h +++ b/src/user/lib/include/bits/file.h @@ -5,5 +5,6 @@ struct FILE { int fd; int pos; bool eof; + bool error; }; typedef struct FILE FILE; diff --git a/src/user/lib/include/stdio.h b/src/user/lib/include/stdio.h index 9d6921a..2f0746f 100644 --- a/src/user/lib/include/stdio.h +++ b/src/user/lib/include/stdio.h @@ -2,6 +2,8 @@ #include <bits/file.h> #include <stddef.h> +#define EOF (-1) + int printf(const char *fmt, ...); int snprintf(char *str, size_t len, const char *fmt, ...); @@ -11,9 +13,9 @@ int _klogf(const char *fmt, ...); // for kernel debugging only extern FILE *const stdin, *const stdout; FILE *fopen(const char *path, const char *mode); -FILE *freopen(const char *path, const char *mode, FILE*); +FILE *freopen(const char *path, const char *mode, FILE *); FILE *fdopen(int fd, const char *mode); -FILE *file_clone(const FILE*); -int file_read(FILE*, char *buf, size_t len); -int file_write(FILE*, const char *buf, size_t len); -void file_close(FILE*); +FILE *file_clone(const FILE *); +size_t fread(void *restrict ptr, size_t size, size_t nitems, FILE *restrict); +size_t fwrite(const void *restrict ptr, size_t size, size_t nitems, FILE *restrict); +int fclose(FILE *); |