52 lines
1.5 KiB
C
52 lines
1.5 KiB
C
#ifndef _STDIO_H
|
|
#define _STDIO_H
|
|
|
|
#include <stdarg.h>
|
|
|
|
typedef struct __sFILE FILE;
|
|
typedef unsigned int size_t;
|
|
|
|
extern FILE *stdin;
|
|
extern FILE *stdout;
|
|
extern FILE *stderr;
|
|
|
|
int putchar(int c);
|
|
int puts(const char *s);
|
|
int printf(const char *fmt, ...);
|
|
int vprintf(const char *fmt, va_list ap);
|
|
int sprintf(char *buf, const char *fmt, ...);
|
|
int snprintf(char *buf, size_t n, const char *fmt, ...);
|
|
int vsprintf(char *buf, const char *fmt, va_list ap);
|
|
int vsnprintf(char *buf, size_t n, const char *fmt, va_list ap);
|
|
int fprintf(FILE *stream, const char *fmt, ...);
|
|
int vfprintf(FILE *stream, const char *fmt, va_list ap);
|
|
void perror(const char *prefix);
|
|
int fputc(int c, FILE *stream);
|
|
int fputs(const char *s, FILE *stream);
|
|
int fflush(FILE *stream);
|
|
int fclose(FILE *stream);
|
|
|
|
FILE *fopen(const char *path, const char *mode);
|
|
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 fseek(FILE *stream, long offset, int whence);
|
|
long ftell(FILE *stream);
|
|
int feof(FILE *stream);
|
|
int ferror(FILE *stream);
|
|
void clearerr(FILE *stream);
|
|
|
|
#define SEEK_SET 0
|
|
#define SEEK_CUR 1
|
|
#define SEEK_END 2
|
|
|
|
#define EOF (-1)
|
|
|
|
// Input stubs. Real implementations would route through GS/OS
|
|
// console I/O; current impl in libc.c returns EOF / 0.
|
|
int getchar(void);
|
|
int fgetc(FILE *stream);
|
|
char *fgets(char *buf, int n, FILE *stream);
|
|
int ungetc(int c, FILE *stream);
|
|
#define getc(s) fgetc(s)
|
|
|
|
#endif
|