stdio.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #ifndef __GBLIBC_STDIO_H_
  2. #define __GBLIBC_STDIO_H_
  3. #include <stdarg.h>
  4. #include <stdint.h>
  5. #undef EOF
  6. #define EOF (-1)
  7. #undef BUFSIZ
  8. #define BUFSIZ (1024)
  9. #ifdef __cplusplus
  10. extern "C" {
  11. #endif
  12. typedef struct __io_file {
  13. int fd;
  14. uint32_t flags;
  15. char* rbuf;
  16. size_t rpos;
  17. size_t rcnt;
  18. size_t rbsz;
  19. char* wbuf;
  20. size_t wpos;
  21. size_t wbsz;
  22. } FILE;
  23. int putchar(int character);
  24. int getchar(void);
  25. int puts(const char* str);
  26. char* gets(char* str);
  27. int vsnprintf(char* buf, size_t bufsize, const char* fmt, va_list args);
  28. int snprintf(char* buf, size_t bufsize, const char* fmt, ...);
  29. int sprintf(char* buf, const char* fmt, ...);
  30. int vfprintf(FILE* stream, const char* fmt, va_list args);
  31. int fprintf(FILE* stream, const char* fmt, ...);
  32. int vprintf(const char* fmt, va_list args);
  33. int printf(const char* fmt, ...);
  34. FILE* fopen(const char* path, const char* mode);
  35. int fflush(FILE* stream);
  36. int fclose(FILE* stream);
  37. int getc_unlocked(FILE* stream);
  38. int putc_unlocked(int character, FILE* stream);
  39. int fputs_unlocked(const char* s, FILE* stream);
  40. int fputc_unlocked(int character, FILE* stream);
  41. int fputs(const char* s, FILE* stream);
  42. int fgetc(FILE* stream);
  43. int fputc(int character, FILE* stream);
  44. extern FILE* stdout;
  45. extern FILE* stdin;
  46. extern FILE* stderr;
  47. #undef stdout
  48. #undef stdin
  49. #undef stderr
  50. #define stdout (stdout)
  51. #define stdin (stdin)
  52. #define stderr (stderr)
  53. #ifdef __cplusplus
  54. }
  55. #endif
  56. #endif