MyOS Libc
stdio.h
Go to the documentation of this file.
1 
4 #ifndef STDIO_H
5 #define STDIO_H
6 
7 #include <stdarg.h>
8 #include <stddef.h>
9 #include <sys/types.h>
10 
11 #define SEEK_CUR 1
12 #define SEEK_END 2
13 #define SEEK_SET 3
14 #define EOF -1
15 
16 
19 typedef struct {
20  pid_t fs_pid;
21  void* fs_data;
22  int pos;
23 } FILE;
24 
25 extern FILE* stdin;
26 extern FILE* stdout;
27 extern FILE* stderr;
28 
35 FILE* fopen(char* filename,char* mode);
36 
42 int fgetc(FILE* stream);
43 
49 int getc(FILE* stream);
50 
58 char* fgets(char* str,int count,FILE* stream);
59 
66 char* gets(char* str);
67 
76 size_t fread(void* buffer,size_t size,size_t count,FILE* stream);
77 
84 int fputc(int c,FILE* stream);
85 
92 int putc(int c,FILE* stream);
93 
100 int fputs(const char* s,FILE* stream);
101 
110 size_t fwrite(void* buffer_ptr,size_t size,size_t count,FILE* stream);
111 
117 int puts(const char* s);
118 
126 int fprintf(FILE* stream,const char* format,...);
127 
135 int vfprintf(FILE* stream,const char* format,va_list arg);
136 
143 int printf(const char* format,...);
144 
152 int fseek(FILE* stream,long offset,int origin);
153 
159 long ftell(FILE* stream);
160 
166 int fclose(FILE* file);
167 
173 int feof(FILE* stream);
174 
180 int ferror(FILE* stream);
181 
186 int fflush(FILE *stream);
187 
197 void setbuf(FILE *restrict stream, char *restrict buf);
198 
204 void register_fs(const char* name,pid_t pid);
205 
213 int mount(char* file,char* type,char* path);
214 
215 #endif
fclose
int fclose(FILE *file)
fseek
int fseek(FILE *stream, long offset, int origin)
Definition: stdio.c:260
FILE::pos
int pos
Positiom in the file.
Definition: stdio.h:22
fflush
int fflush(FILE *stream)
fwrite
size_t fwrite(void *buffer_ptr, size_t size, size_t count, FILE *stream)
Definition: stdio.c:143
FILE::fs_pid
pid_t fs_pid
PID of the filesytem drive for this file.
Definition: stdio.h:20
ftell
long ftell(FILE *stream)
stderr
FILE * stderr
Standard error.
Definition: stdio.c:15
stdin
FILE * stdin
Standard input.
Definition: stdio.c:13
FILE::fs_data
void * fs_data
Pointer given by the filesytem driver to its info about the file.
Definition: stdio.h:21
mount
int mount(char *file, char *type, char *path)
Definition: stdio.c:165
puts
int puts(const char *s)
Definition: stdio.c:124
fgetc
int fgetc(FILE *stream)
Definition: stdio.c:70
stdout
FILE * stdout
Standard output.
Definition: stdio.c:14
getc
int getc(FILE *stream)
ferror
int ferror(FILE *stream)
gets
char * gets(char *str)
Definition: stdio.c:80
fputc
int fputc(int c, FILE *stream)
Definition: stdio.c:53
setbuf
void setbuf(FILE *restrict stream, char *restrict buf)
fopen
FILE * fopen(char *filename, char *mode)
Definition: stdio.c:24
fread
size_t fread(void *buffer, size_t size, size_t count, FILE *stream)
Definition: stdio.c:104
putc
int putc(int c, FILE *stream)
fgets
char * fgets(char *str, int count, FILE *stream)
Definition: stdio.c:84
fputs
int fputs(const char *s, FILE *stream)
Definition: stdio.c:134
FILE
Definition: stdio.h:19
fprintf
int fprintf(FILE *stream, const char *format,...)
Definition: stdio.c:234
register_fs
void register_fs(const char *name, pid_t pid)
Definition: stdio.c:158
printf
int printf(const char *format,...)
Definition: stdio.c:247
vfprintf
int vfprintf(FILE *stream, const char *format, va_list arg)
Definition: stdio.c:174
feof
int feof(FILE *stream)