blob: 35941ce35156215523e89f3ec111f9ed91a88c0b [file] [log] [blame]
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00001// -*- C++ -*-
2//===---------------------------- cstdio ----------------------------------===//
3//
Howard Hinnantf5256e12010-05-11 21:36:01 +00004// The LLVM Compiler Infrastructure
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00005//
Howard Hinnantb64f8b02010-11-16 22:09:02 +00006// This file is dual licensed under the MIT and the University of Illinois Open
7// Source Licenses. See LICENSE.TXT for details.
Howard Hinnantbc8d3f92010-05-11 19:42:16 +00008//
9//===----------------------------------------------------------------------===//
10
11#ifndef _LIBCPP_CSTDIO
12#define _LIBCPP_CSTDIO
13
14/*
15 cstdio synopsis
16
17Macros:
18
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
36namespace std
37{
38
39Types:
40
41FILE
42fpos_t
43size_t
44
45int remove(const char* filename);
46int rename(const char* old, const char* new);
47FILE* tmpfile(void);
48char* tmpnam(char* s);
49int fclose(FILE* stream);
50int fflush(FILE* stream);
51FILE* fopen(const char* restrict filename, const char* restrict mode);
52FILE* freopen(const char* restrict filename, const char * restrict mode,
53 FILE * restrict stream);
54void setbuf(FILE* restrict stream, char* restrict buf);
55int setvbuf(FILE* restrict stream, char* restrict buf, int mode, size_t size);
56int fprintf(FILE* restrict stream, const char* restrict format, ...);
57int fscanf(FILE* restrict stream, const char * restrict format, ...);
58int printf(const char* restrict format, ...);
59int scanf(const char* restrict format, ...);
60int snprintf(char* restrict s, size_t n, const char* restrict format, ...); // C99
61int sprintf(char* restrict s, const char* restrict format, ...);
62int sscanf(const char* restrict s, const char* restrict format, ...);
63int vfprintf(FILE* restrict stream, const char* restrict format, va_list arg);
64int vfscanf(FILE* restrict stream, const char* restrict format, va_list arg); // C99
65int vprintf(const char* restrict format, va_list arg);
66int vscanf(const char* restrict format, va_list arg); // C99
67int vsnprintf(char* restrict s, size_t n, const char* restrict format, // C99
68 va_list arg);
69int vsprintf(char* restrict s, const char* restrict format, va_list arg);
70int vsscanf(const char* restrict s, const char* restrict format, va_list arg); // C99
71int fgetc(FILE* stream);
72char* fgets(char* restrict s, int n, FILE* restrict stream);
73int fputc(int c, FILE* stream);
74int fputs(const char* restrict s, FILE* restrict stream);
75int getc(FILE* stream);
76int getchar(void);
Marshall Clow12067202013-10-12 19:09:47 +000077char* gets(char* s); // removed in C++14
Howard Hinnantbc8d3f92010-05-11 19:42:16 +000078int putc(int c, FILE* stream);
79int putchar(int c);
80int puts(const char* s);
81int ungetc(int c, FILE* stream);
82size_t fread(void* restrict ptr, size_t size, size_t nmemb,
83 FILE* restrict stream);
84size_t fwrite(const void* restrict ptr, size_t size, size_t nmemb,
85 FILE* restrict stream);
86int fgetpos(FILE* restrict stream, fpos_t* restrict pos);
87int fseek(FILE* stream, long offset, int whence);
88int fsetpos(FILE*stream, const fpos_t* pos);
89long ftell(FILE* stream);
90void rewind(FILE* stream);
91void clearerr(FILE* stream);
92int feof(FILE* stream);
93int ferror(FILE* stream);
94void perror(const char* s);
95
96} // std
97*/
98
99#include <__config>
100#include <stdio.h>
Saleem Abdulrasoolebeef1b2016-09-01 21:09:19 +0000101#if defined(_LIBCPP_MSVCRT)
102#include <crtversion.h>
103#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000104
Howard Hinnant08e17472011-10-17 20:05:10 +0000105#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000106#pragma GCC system_header
Howard Hinnant08e17472011-10-17 20:05:10 +0000107#endif
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000108
109_LIBCPP_BEGIN_NAMESPACE_STD
110
111using ::FILE;
112using ::fpos_t;
113using ::size_t;
114
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000115using ::fclose;
116using ::fflush;
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000117using ::setbuf;
118using ::setvbuf;
119using ::fprintf;
120using ::fscanf;
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000121using ::snprintf;
122using ::sprintf;
123using ::sscanf;
124using ::vfprintf;
125using ::vfscanf;
Howard Hinnant78b68282011-10-22 20:59:45 +0000126using ::vsscanf;
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000127using ::vsnprintf;
128using ::vsprintf;
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000129using ::fgetc;
130using ::fgets;
131using ::fputc;
132using ::fputs;
133using ::getc;
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000134using ::putc;
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000135using ::ungetc;
136using ::fread;
137using ::fwrite;
138using ::fgetpos;
139using ::fseek;
140using ::fsetpos;
141using ::ftell;
142using ::rewind;
143using ::clearerr;
144using ::feof;
145using ::ferror;
146using ::perror;
147
Ed Schoutenabd06b42015-03-26 14:35:46 +0000148#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
149using ::fopen;
150using ::freopen;
151using ::remove;
152using ::rename;
153using ::tmpfile;
154using ::tmpnam;
155#endif
156
157#ifndef _LIBCPP_HAS_NO_STDIN
158using ::getchar;
Saleem Abdulrasoolebeef1b2016-09-01 21:09:19 +0000159#if _LIBCPP_STD_VER <= 11 && \
160 (!defined(_VC_CRT_MAJOR_VERSION) || _VC_CRT_MAJOR_VERSION < 14)
Ed Schoutenabd06b42015-03-26 14:35:46 +0000161using ::gets;
162#endif
163using ::scanf;
164using ::vscanf;
165#endif
166
167#ifndef _LIBCPP_HAS_NO_STDOUT
168using ::printf;
169using ::putchar;
170using ::puts;
171using ::vprintf;
172#endif
173
Howard Hinnantbc8d3f92010-05-11 19:42:16 +0000174_LIBCPP_END_NAMESPACE_STD
175
176#endif // _LIBCPP_CSTDIO