stdio.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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 vasprintf(char** strp, const char* fmt, va_list args);
  31. int asprintf(char** strp, const char* fmt, ...);
  32. int vfprintf(FILE* stream, const char* fmt, va_list args);
  33. int fprintf(FILE* stream, const char* fmt, ...);
  34. int vprintf(const char* fmt, va_list args);
  35. int printf(const char* fmt, ...);
  36. FILE* fopen(const char* path, const char* mode);
  37. int fflush(FILE* stream);
  38. int fclose(FILE* stream);
  39. int getc_unlocked(FILE* stream);
  40. int putc_unlocked(int character, FILE* stream);
  41. int fputs_unlocked(const char* s, FILE* stream);
  42. int fputc_unlocked(int character, FILE* stream);
  43. int fputs(const char* s, FILE* stream);
  44. int fgetc(FILE* stream);
  45. int fputc(int character, FILE* stream);
  46. int ferror(FILE* stream);
  47. int ferror_unlocked(FILE* stream);
  48. int feof(FILE* stream);
  49. void clearerr(FILE* stream);
  50. extern FILE* stdout;
  51. extern FILE* stdin;
  52. extern FILE* stderr;
  53. #undef stdout
  54. #undef stdin
  55. #undef stderr
  56. #define stdout (stdout)
  57. #define stdin (stdin)
  58. #define stderr (stderr)
  59. #ifdef __cplusplus
  60. }
  61. #endif
  62. #endif