From: Sebastien Bourdeauducq Date: Fri, 25 May 2012 20:45:28 +0000 (+0200) Subject: software/libbase: provide file I/O declaration X-Git-Tag: 24jan2021_ls180~3162 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=37b578854b6bd0d95dfdd49220d13831f34cf85c;p=litex.git software/libbase: provide file I/O declaration --- diff --git a/software/include/base/stdio.h b/software/include/base/stdio.h index 869c6498..8073e7dd 100644 --- a/software/include/base/stdio.h +++ b/software/include/base/stdio.h @@ -1,7 +1,7 @@ #ifndef __STDIO_H #define __STDIO_H -#include +#include int putchar(int c); int puts(const char *s); @@ -12,4 +12,28 @@ int sprintf(char *buf, const char *fmt, ...); int printf(const char *fmt, ...); +/* + * Note: this library does not provide FILE operations. + * User code must implement them. + */ + +#ifndef BUFSIZ +#define BUFSIZ 1024 +#endif + +typedef int FILE; + +extern FILE *stdin; +extern FILE *stdout; +extern FILE *stderr; + +int fprintf(FILE *stream, const char *format, ...); +int fflush(FILE *stream); + +FILE *fopen(const char *path, const char *mode); +char *fgets(char *s, int size, FILE *stream); +size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream); +size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream); +int fclose(FILE *fp); + #endif /* __STDIO_H */