Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
145 | halyavin | 1 | #ifndef stdio_h |
2 | #define stdio_h |
||
647 | andrew_pro | 3 | |
4 | #include "kolibrisys.h" |
||
6424 | siemargl | 5 | #include |
6 | /* use stdarg.h |
||
647 | andrew_pro | 7 | typedef char *va_list; |
8 | #define _roundsize(n) ( (sizeof(n) + 3) & ~3 ) |
||
9 | #define va_start(ap,v) (ap = (va_list)&v+_roundsize(v)) |
||
10 | #define va_arg(ap,t) ( *(t *)((ap += _roundsize(t)) - _roundsize(t)) ) |
||
11 | #define va_end(ap) (ap = (va_list)0) |
||
6424 | siemargl | 12 | */ |
13 | #ifndef NULL |
||
14 | # define NULL ((void*)0) |
||
15 | #endif |
||
647 | andrew_pro | 16 | |
6412 | siemargl | 17 | int format_print(char *dest, size_t maxlen,const char *fmt0, va_list argp); |
647 | andrew_pro | 18 | |
145 | halyavin | 19 | typedef struct { |
611 | andrew_pro | 20 | char* buffer; |
21 | dword buffersize; |
||
22 | dword filesize; |
||
23 | dword filepos; |
||
24 | char* filename; |
||
25 | int mode; |
||
145 | halyavin | 26 | } FILE; |
647 | andrew_pro | 27 | |
6424 | siemargl | 28 | #define stderr ((FILE*)3) /* works inly for fprintf!!! */ |
29 | |||
30 | |||
145 | halyavin | 31 | #define FILE_OPEN_READ 0 |
32 | #define FILE_OPEN_WRITE 1 |
||
33 | #define FILE_OPEN_APPEND 2 |
||
34 | #define FILE_OPEN_TEXT 4 |
||
35 | #define FILE_OPEN_PLUS 8 |
||
36 | #define EOF -1 |
||
647 | andrew_pro | 37 | |
145 | halyavin | 38 | extern FILE* fopen(const char* filename, const char *mode); |
611 | andrew_pro | 39 | extern void fclose(FILE* file); |
145 | halyavin | 40 | extern int feof(FILE* file); |
41 | extern int fflush(FILE* file); |
||
42 | extern int fgetc(FILE* file); |
||
43 | extern int fgetpos(FILE* file,fpos_t* pos); |
||
44 | extern int fsetpos(FILE* file,const fpos_t* pos); |
||
45 | extern int fputc(int c,FILE* file); |
||
46 | extern int fread(void* buffer,int size,int count,FILE* file); |
||
611 | andrew_pro | 47 | extern int fwrite(void *buffer,int size,int count,FILE* file); |
145 | halyavin | 48 | extern long ftell(FILE* file); |
49 | #define SEEK_CUR 0 |
||
50 | #define SEEK_END 1 |
||
51 | #define SEEK_SET 2 |
||
52 | extern int fseek(FILE* file,long offset,int origin); |
||
53 | extern void rewind(FILE* file); |
||
647 | andrew_pro | 54 | extern int cdecl fprintf(FILE* file, const char* format,...); |
55 | extern int fscanf(FILE* file,const char* format,...); |
||
145 | halyavin | 56 | extern int ungetc(int c,FILE* file); |
647 | andrew_pro | 57 | |
58 | extern int cdecl printf(const char *format,...); |
||
59 | |||
60 | extern int vsnprintf(char *dest, size_t size,const char *format,va_list ap); |
||
61 | extern int cdecl snprintf(char *dest, size_t size, const char *format,...); |
||
62 | extern int cdecl sprintf(char *dest,const char *format,...); |
||
63 | |||
6412 | siemargl | 64 | #define getc(a) fgetc(a) |
6429 | siemargl | 65 | char * fgets (char * str, int num, FILE * stream); |
66 | int putchar (int ch); |
||
67 | int getchar (void); |
||
68 | int puts (const char * str); |
||
69 | char * gets (char * str); |
||
6412 | siemargl | 70 | |
145 | halyavin | 71 | #endif |