CoolPotOS/apps/include/stdio.h

66 lines
1.7 KiB
C
Raw Normal View History

2024-07-14 00:54:27 +08:00
#ifndef CRASHPOWEROS_STDIO_H
#define CRASHPOWEROS_STDIO_H
2024-09-01 14:56:38 +08:00
#define EOF -1
#define CANREAD(flag) ((flag)&READ || (flag)&PLUS)
#define CANWRITE(flag) ((flag)&WRITE || (flag)&PLUS || (flag)&APPEND)
#define READ 0x2
#define WRITE 0x4
#define APPEND 0x8
#define BIN 0x0
#define PLUS 0x10
2024-09-08 22:43:05 +08:00
#define BUFSIZ (4096*2)
#define SEEK_SET 0
#define SEEK_CUR 1
#define SEEK_END 2
2024-09-01 14:56:38 +08:00
2024-09-01 16:43:58 +08:00
#include "ctype.h"
2024-08-30 16:12:44 +08:00
2024-09-01 14:56:38 +08:00
typedef struct FILE {
unsigned int mode;
unsigned int fileSize;
unsigned char *buffer;
unsigned int bufferSize;
unsigned int p;
char *name;
} FILE;
2024-09-08 22:43:05 +08:00
extern FILE *stdout;
extern FILE *stdin;
extern FILE *stderr;
int getc();
int getch();
void put_char(char a);
2024-09-06 00:16:50 +08:00
int scanf(const char *format, ...);
2024-08-31 12:36:49 +08:00
int printf(const char* fmt, ...);
2024-09-08 22:43:05 +08:00
void print(const char* msg);
2024-08-31 12:36:49 +08:00
int puts(const char *s);
int vsprintf(char *buf, const char *fmt, va_list args);
2024-09-08 22:43:05 +08:00
int vsnprintf(char *buf, size_t n, const char *fmt, va_list ap);
int sprintf(char *buf, const char *fmt, ...);
int snprintf(char *s, size_t n, const char *fmt, ...);
2024-09-01 14:56:38 +08:00
int fgetc(FILE *stream);
FILE *fopen(char *filename, char *mode);
unsigned int fread(void *buffer, unsigned int size, unsigned int count,
FILE *stream);
int fclose(FILE *fp);
char *fgets(char *str, int n, FILE *stream);
int fputs(const char *str, FILE *stream);
int fprintf(FILE *stream, const char *format, ...);
int fputc(int ch, FILE *stream);
2024-09-08 22:43:05 +08:00
int fflush(FILE *stream);
2024-09-01 14:56:38 +08:00
unsigned int fwrite(const void *ptr, unsigned int size, unsigned int nmemb,
FILE *stream);
2024-09-08 22:43:05 +08:00
int fseek(FILE *fp, int offset, int whence);
long ftell(FILE *stream);
int feof(FILE *stream);
int ferror(FILE *stream);
int filesize(const char* filename);
int remove(char *filename);
int rename(char *filename1, char *filename2);
2024-07-14 00:54:27 +08:00
#endif