stdio.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. // -*- C++ -*-
  2. //===----------------------------------------------------------------------===//
  3. //
  4. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  5. // See https://llvm.org/LICENSE.txt for license information.
  6. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  7. //
  8. //===----------------------------------------------------------------------===//
  9. #if defined(__need_FILE) || defined(__need___FILE)
  10. #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
  11. # pragma GCC system_header
  12. #endif
  13. #include_next <stdio.h>
  14. #elif !defined(_LIBCPP_STDIO_H)
  15. #define _LIBCPP_STDIO_H
  16. /*
  17. stdio.h synopsis
  18. Macros:
  19. BUFSIZ
  20. EOF
  21. FILENAME_MAX
  22. FOPEN_MAX
  23. L_tmpnam
  24. NULL
  25. SEEK_CUR
  26. SEEK_END
  27. SEEK_SET
  28. TMP_MAX
  29. _IOFBF
  30. _IOLBF
  31. _IONBF
  32. stderr
  33. stdin
  34. stdout
  35. Types:
  36. FILE
  37. fpos_t
  38. size_t
  39. int remove(const char* filename);
  40. int rename(const char* old, const char* new);
  41. FILE* tmpfile(void);
  42. char* tmpnam(char* s);
  43. int fclose(FILE* stream);
  44. int fflush(FILE* stream);
  45. FILE* fopen(const char* restrict filename, const char* restrict mode);
  46. FILE* freopen(const char* restrict filename, const char * restrict mode,
  47. FILE * restrict stream);
  48. void setbuf(FILE* restrict stream, char* restrict buf);
  49. int setvbuf(FILE* restrict stream, char* restrict buf, int mode, size_t size);
  50. int fprintf(FILE* restrict stream, const char* restrict format, ...);
  51. int fscanf(FILE* restrict stream, const char * restrict format, ...);
  52. int printf(const char* restrict format, ...);
  53. int scanf(const char* restrict format, ...);
  54. int snprintf(char* restrict s, size_t n, const char* restrict format, ...); // C99
  55. int sprintf(char* restrict s, const char* restrict format, ...);
  56. int sscanf(const char* restrict s, const char* restrict format, ...);
  57. int vfprintf(FILE* restrict stream, const char* restrict format, va_list arg);
  58. int vfscanf(FILE* restrict stream, const char* restrict format, va_list arg); // C99
  59. int vprintf(const char* restrict format, va_list arg);
  60. int vscanf(const char* restrict format, va_list arg); // C99
  61. int vsnprintf(char* restrict s, size_t n, const char* restrict format, // C99
  62. va_list arg);
  63. int vsprintf(char* restrict s, const char* restrict format, va_list arg);
  64. int vsscanf(const char* restrict s, const char* restrict format, va_list arg); // C99
  65. int fgetc(FILE* stream);
  66. char* fgets(char* restrict s, int n, FILE* restrict stream);
  67. int fputc(int c, FILE* stream);
  68. int fputs(const char* restrict s, FILE* restrict stream);
  69. int getc(FILE* stream);
  70. int getchar(void);
  71. char* gets(char* s); // removed in C++14
  72. int putc(int c, FILE* stream);
  73. int putchar(int c);
  74. int puts(const char* s);
  75. int ungetc(int c, FILE* stream);
  76. size_t fread(void* restrict ptr, size_t size, size_t nmemb,
  77. FILE* restrict stream);
  78. size_t fwrite(const void* restrict ptr, size_t size, size_t nmemb,
  79. FILE* restrict stream);
  80. int fgetpos(FILE* restrict stream, fpos_t* restrict pos);
  81. int fseek(FILE* stream, long offset, int whence);
  82. int fsetpos(FILE*stream, const fpos_t* pos);
  83. long ftell(FILE* stream);
  84. void rewind(FILE* stream);
  85. void clearerr(FILE* stream);
  86. int feof(FILE* stream);
  87. int ferror(FILE* stream);
  88. void perror(const char* s);
  89. */
  90. #include <__config>
  91. #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
  92. # pragma GCC system_header
  93. #endif
  94. # if __has_include_next(<stdio.h>)
  95. # include_next <stdio.h>
  96. # endif
  97. #ifdef __cplusplus
  98. #undef getc
  99. #undef putc
  100. #undef clearerr
  101. #undef feof
  102. #undef ferror
  103. #undef putchar
  104. #undef getchar
  105. #endif
  106. #endif // _LIBCPP_STDIO_H