stdio.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. char* rbuf;
  15. char* wbuf;
  16. size_t rpos;
  17. size_t wpos;
  18. size_t rbsz;
  19. size_t wbsz;
  20. uint32_t flags;
  21. } FILE;
  22. int putchar(int character);
  23. int puts(const char* str);
  24. char* gets(char* str);
  25. int vsnprintf(char* buf, size_t bufsize, const char* fmt, va_list args);
  26. int snprintf(char* buf, size_t bufsize, const char* fmt, ...);
  27. int sprintf(char* buf, const char* fmt, ...);
  28. int vfprintf(FILE* stream, const char* fmt, va_list args);
  29. int fprintf(FILE* stream, const char* fmt, ...);
  30. int vprintf(const char* fmt, va_list args);
  31. int printf(const char* fmt, ...);
  32. FILE* fopen(const char* path, const char* mode);
  33. int fflush(FILE* stream);
  34. int fclose(FILE* stream);
  35. int fputs_unlocked(const char* s, FILE* stream);
  36. int fputc_unlocked(int character, FILE* stream);
  37. int fputs(const char* s, FILE* stream);
  38. int fputc(int character, FILE* stream);
  39. extern FILE* stdout;
  40. extern FILE* stdin;
  41. extern FILE* stderr;
  42. #undef stdout
  43. #undef stdin
  44. #undef stderr
  45. #define stdout (stdout)
  46. #define stdin (stdin)
  47. #define stderr (stderr)
  48. #ifdef __cplusplus
  49. }
  50. #endif
  51. #endif