2006-09-07 18:14:53 +04:00
|
|
|
#ifndef stdio_h
|
|
|
|
#define stdio_h
|
2007-10-15 13:42:17 +04:00
|
|
|
|
|
|
|
#include "kolibrisys.h"
|
2016-05-11 17:53:54 +03:00
|
|
|
#include <stdarg.h>
|
|
|
|
/* use stdarg.h
|
2007-10-15 13:42:17 +04:00
|
|
|
typedef char *va_list;
|
|
|
|
#define _roundsize(n) ( (sizeof(n) + 3) & ~3 )
|
|
|
|
#define va_start(ap,v) (ap = (va_list)&v+_roundsize(v))
|
|
|
|
#define va_arg(ap,t) ( *(t *)((ap += _roundsize(t)) - _roundsize(t)) )
|
|
|
|
#define va_end(ap) (ap = (va_list)0)
|
2016-05-11 17:53:54 +03:00
|
|
|
*/
|
|
|
|
#ifndef NULL
|
|
|
|
# define NULL ((void*)0)
|
|
|
|
#endif
|
2007-10-15 13:42:17 +04:00
|
|
|
|
2016-04-30 16:50:04 +03:00
|
|
|
int format_print(char *dest, size_t maxlen,const char *fmt0, va_list argp);
|
2007-10-15 13:42:17 +04:00
|
|
|
|
2006-09-07 18:14:53 +04:00
|
|
|
typedef struct {
|
2007-08-24 23:52:54 +04:00
|
|
|
char* buffer;
|
|
|
|
dword buffersize;
|
|
|
|
dword filesize;
|
|
|
|
dword filepos;
|
|
|
|
char* filename;
|
|
|
|
int mode;
|
2006-09-07 18:14:53 +04:00
|
|
|
} FILE;
|
2007-10-15 13:42:17 +04:00
|
|
|
|
2016-05-11 17:53:54 +03:00
|
|
|
#define stderr ((FILE*)3) /* works inly for fprintf!!! */
|
|
|
|
|
|
|
|
|
2006-09-07 18:14:53 +04:00
|
|
|
#define FILE_OPEN_READ 0
|
|
|
|
#define FILE_OPEN_WRITE 1
|
|
|
|
#define FILE_OPEN_APPEND 2
|
|
|
|
#define FILE_OPEN_TEXT 4
|
|
|
|
#define FILE_OPEN_PLUS 8
|
|
|
|
#define EOF -1
|
2007-10-15 13:42:17 +04:00
|
|
|
|
2006-09-07 18:14:53 +04:00
|
|
|
extern FILE* fopen(const char* filename, const char *mode);
|
2007-08-24 23:52:54 +04:00
|
|
|
extern void fclose(FILE* file);
|
2006-09-07 18:14:53 +04:00
|
|
|
extern int feof(FILE* file);
|
|
|
|
extern int fflush(FILE* file);
|
|
|
|
extern int fgetc(FILE* file);
|
|
|
|
extern int fgetpos(FILE* file,fpos_t* pos);
|
|
|
|
extern int fsetpos(FILE* file,const fpos_t* pos);
|
|
|
|
extern int fputc(int c,FILE* file);
|
|
|
|
extern int fread(void* buffer,int size,int count,FILE* file);
|
2007-08-24 23:52:54 +04:00
|
|
|
extern int fwrite(void *buffer,int size,int count,FILE* file);
|
2006-09-07 18:14:53 +04:00
|
|
|
extern long ftell(FILE* file);
|
|
|
|
#define SEEK_CUR 0
|
|
|
|
#define SEEK_END 1
|
|
|
|
#define SEEK_SET 2
|
|
|
|
extern int fseek(FILE* file,long offset,int origin);
|
|
|
|
extern void rewind(FILE* file);
|
2007-10-15 13:42:17 +04:00
|
|
|
extern int cdecl fprintf(FILE* file, const char* format,...);
|
|
|
|
extern int fscanf(FILE* file,const char* format,...);
|
2006-09-07 18:14:53 +04:00
|
|
|
extern int ungetc(int c,FILE* file);
|
2007-10-15 13:42:17 +04:00
|
|
|
|
|
|
|
extern int cdecl printf(const char *format,...);
|
|
|
|
|
|
|
|
extern int vsnprintf(char *dest, size_t size,const char *format,va_list ap);
|
|
|
|
extern int cdecl snprintf(char *dest, size_t size, const char *format,...);
|
|
|
|
extern int cdecl sprintf(char *dest,const char *format,...);
|
|
|
|
|
2016-04-30 16:50:04 +03:00
|
|
|
#define getc(a) fgetc(a)
|
2016-05-11 17:53:54 +03:00
|
|
|
char * fgets ( char * str, int num, FILE * stream );
|
|
|
|
int putchar ( int character );
|
2016-04-30 16:50:04 +03:00
|
|
|
|
2006-09-07 18:14:53 +04:00
|
|
|
#endif
|