lib: c: io: implement standard FILE and DIR interfaces

This commit is contained in:
2026-03-25 20:21:12 +00:00
parent b975256cb9
commit 96784f611f
21 changed files with 599 additions and 0 deletions
+29
View File
@@ -4,10 +4,15 @@
#include <stdarg.h>
#include <stddef.h>
#define EOF -1
#ifdef __cplusplus
extern "C" {
#endif
struct __opaque_file;
typedef struct __opaque_file FILE;
extern int snprintf(char *buffer, size_t count, const char *format, ...);
extern int vsnprintf(
char *buffer,
@@ -15,6 +20,30 @@ extern int vsnprintf(
const char *format,
va_list va);
extern FILE *fopen(const char *path, const char *mode);
extern int fclose(FILE *stream);
extern int feof(FILE *stream);
extern int ferr(FILE *stream);
extern size_t fread(void *buf, size_t size, size_t count, FILE *stream);
extern size_t fwrite(const void *buf, size_t size, size_t count, FILE *stream);
extern int fgetc(FILE *stream);
static inline int getc(FILE *stream)
{
return fgetc(stream);
}
extern int fputc(int c, FILE *stream);
static inline int putc(int c, FILE *stream)
{
return fputc(c, stream);
}
extern char *fgets(char *restrict str, int count, FILE *restrict stream);
extern int fputs(const char *restrict str, FILE *restrict stream);
#ifdef __cplusplus
}
#endif