stdio.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. #ifndef _STDIO_H
  2. #define _STDIO_H
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. #define __NEED_FILE
  7. #define __NEED_va_list
  8. #define __NEED_size_t
  9. #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
  10. || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)
  11. #define __NEED_ssize_t
  12. #define __NEED_off_t
  13. #endif
  14. #include <bits/alltypes.h>
  15. #undef NULL
  16. #ifdef __cplusplus
  17. #define NULL 0
  18. #else
  19. #define NULL ((void*)0)
  20. #endif
  21. #undef EOF
  22. #define EOF (-1)
  23. #undef SEEK_SET
  24. #undef SEEK_CUR
  25. #undef SEEK_END
  26. #define SEEK_SET 0
  27. #define SEEK_CUR 1
  28. #define SEEK_END 2
  29. #define _IOFBF 0
  30. #define _IOLBF 1
  31. #define _IONBF 2
  32. #define BUFSIZ 1024
  33. #define FILENAME_MAX 4095
  34. #define FOPEN_MAX 1000
  35. #define TMP_MAX 10000
  36. #define L_tmpnam 20
  37. typedef union {
  38. char __opaque[16];
  39. double __align;
  40. } fpos_t;
  41. extern FILE *const stdin;
  42. extern FILE *const stdout;
  43. extern FILE *const stderr;
  44. #define stdin (stdin)
  45. #define stdout (stdout)
  46. #define stderr (stderr)
  47. FILE *fopen(const char *, const char *);
  48. FILE *freopen(const char *, const char *, FILE *);
  49. int fclose(FILE *);
  50. int remove(const char *);
  51. int rename(const char *, const char *);
  52. int feof(FILE *);
  53. int ferror(FILE *);
  54. int fflush(FILE *);
  55. void clearerr(FILE *);
  56. int fseek(FILE *, long, int);
  57. long ftell(FILE *);
  58. void rewind(FILE *);
  59. int fgetpos(FILE *, fpos_t *);
  60. int fsetpos(FILE *, const fpos_t *);
  61. size_t fread(void *, size_t, size_t, FILE *);
  62. size_t fwrite(const void *, size_t, size_t, FILE *);
  63. int fgetc(FILE *);
  64. int getc(FILE *);
  65. int getchar(void);
  66. int ungetc(int, FILE *);
  67. int fputc(int, FILE *);
  68. int putc(int, FILE *);
  69. int putchar(int);
  70. char *fgets(char *, int, FILE *);
  71. char *gets(char *);
  72. int fputs(const char *, FILE *);
  73. int puts(const char *);
  74. int printf(const char *, ...);
  75. int fprintf(FILE *, const char *, ...);
  76. int sprintf(char *, const char *, ...);
  77. int snprintf(char *, size_t, const char *, ...);
  78. int vprintf(const char *, va_list);
  79. int vfprintf(FILE *, const char *, va_list);
  80. int vsprintf(char *, const char *, va_list);
  81. int vsnprintf(char *, size_t, const char *, va_list);
  82. int scanf(const char *, ...);
  83. int fscanf(FILE *, const char *, ...);
  84. int sscanf(const char *, const char *, ...);
  85. int vscanf(const char *, va_list);
  86. int vfscanf(FILE *, const char *, va_list);
  87. int vsscanf(const char *, const char *, va_list);
  88. void perror(const char *);
  89. int setvbuf(FILE *, char *, int, size_t);
  90. void setbuf(FILE *, char *);
  91. char *tmpnam(char *);
  92. FILE *tmpfile(void);
  93. #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
  94. || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)
  95. FILE *fmemopen(void *, size_t, const char *);
  96. FILE *open_memstream(char **, size_t *);
  97. FILE *fdopen(int, const char *);
  98. FILE *popen(const char *, const char *);
  99. int pclose(FILE *);
  100. int fileno(FILE *);
  101. int fseeko(FILE *, off_t, int);
  102. off_t ftello(FILE *);
  103. int dprintf(int, const char *, ...);
  104. int vdprintf(int, const char *, va_list);
  105. void flockfile(FILE *);
  106. int ftrylockfile(FILE *);
  107. void funlockfile(FILE *);
  108. int getc_unlocked(FILE *);
  109. int getchar_unlocked(void);
  110. int putc_unlocked(int, FILE *);
  111. int putchar_unlocked(int);
  112. ssize_t getdelim(char **, size_t *, int, FILE *);
  113. ssize_t getline(char **, size_t *, FILE *);
  114. int renameat(int, const char *, int, const char *);
  115. char *ctermid(char *);
  116. #define L_ctermid 20
  117. #endif
  118. #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)
  119. #define P_tmpdir "/tmp"
  120. char *tempnam(const char *, const char *);
  121. #endif
  122. #if defined(_GNU_SOURCE)
  123. #define L_cuserid 20
  124. char *cuserid(char *);
  125. #undef off64_t
  126. #define off64_t off_t
  127. int asprintf(char **, const char *, ...);
  128. int vasprintf(char **, const char *, va_list);
  129. void setlinebuf(FILE *);
  130. void setbuffer(FILE *, char *, size_t);
  131. int fpurge(FILE *);
  132. int fgetc_unlocked(FILE *);
  133. int fputc_unlocked(int, FILE *);
  134. char *fgets_unlocked(char *, int, FILE *);
  135. int fputs_unlocked(const char *, FILE *);
  136. #endif
  137. #ifdef _LARGEFILE64_SOURCE
  138. #define tmpfile64 tmpfile
  139. #define fopen64 fopen
  140. #define freopen64 freopen
  141. #define fseeko64 fseeko
  142. #define ftello64 ftello
  143. #define fgetpos64 fgetpos
  144. #define fsetpos64 fsetpos
  145. #define fpos64_t fpos_t
  146. #define off64_t off_t
  147. #endif
  148. #ifdef __cplusplus
  149. }
  150. #endif
  151. #endif