/
stdio.h
80 lines (63 loc) · 1.9 KB
/
stdio.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#ifndef _FXCG_STDIO_H
#define _FXCG_STDIO_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stddef.h>
#define EOF (-1)
typedef struct {
/* Usual values for stdin and friends, everything else is the handle
* from the system +3 */
unsigned fileno;
unsigned error : 1;
unsigned eof : 1;
/* Just for rewinding the stream. */
unsigned has_unput : 1;
unsigned char unput;
/* Used only for terminal output (on stdout) */
unsigned short termx, termy;
/* Whether to output to the serial (default for stderr and stdout) */
unsigned char out_serial : 1;
/* Whether to output to the screen (default for stdout) */
unsigned char out_screen : 1;
} FILE;
extern FILE _impl_stdin, _impl_stdout, _impl_stderr;
#define stdin (&_impl_stdin)
#define stdout (&_impl_stdout)
#define stderr (&_impl_stderr)
#define BUFSIZ 1
#define SEEK_SET 0
#define SEEK_CUR 1
#define SEEK_END 2
#define FILENAME_MAX 16
#define FOPEN_MAX (1 << (sizeof(FILE) - 1))
FILE *fopen(const char *path, const char *mode);
FILE *fdopen(int fd, const char *mode);
FILE *freopen(const char *path, const char *mode, FILE *stream);
int fclose(FILE *fp);
size_t fread(void *buffer, size_t size, size_t count, FILE *stream);
size_t fwrite(const void *buffer, size_t size, size_t count, FILE *stream);
int fflush(FILE *stream);
int ferror(FILE *stream);
void clearerr(FILE *stream);
int feof(FILE *stream);
int fileno(FILE *stream);
int fgetc(FILE *stream);
char *fgets(char *s, int size, FILE *stream);
int getc(FILE *stream);
int getchar(void);
char *gets(char *s);
int ungetc(int c, FILE *stream);
int fputc(int c, FILE *stream);
#define putc fputc
int putchar(int c);
int puts(const char *s);
int fseek(FILE *f, long offset, int whence);
long ftell(FILE *f);
int printf(const char *fmt, ...);
int sprintf(char *dest, const char *fmt, ...);
int fprintf(FILE *stream, const char *fmt, ...);
#ifdef __cplusplus
}
#endif
#endif