stdio.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. int ferror(FILE* stream);
  45. int feof(FILE* stream);
  46. void clearerr(FILE* stream);
  47. extern FILE* stdout;
  48. extern FILE* stdin;
  49. extern FILE* stderr;
  50. #undef stdout
  51. #undef stdin
  52. #undef stderr
  53. #define stdout (stdout)
  54. #define stdin (stdin)
  55. #define stderr (stderr)
  56. #ifdef __cplusplus
  57. }
  58. #endif
  59. #endif