/*  Copyright (C) 2015  Povilas Kanapickas <povilas@radix.lt>

    This file is part of cppreference-doc

    This work is licensed under the Creative Commons Attribution-ShareAlike 3.0
    Unported License. To view a copy of this license, visit
    http://creativecommons.org/licenses/by-sa/3.0/ or send a letter to Creative
    Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA.

    Permission is granted to copy, distribute and/or modify this document
    under the terms of the GNU Free Documentation License, Version 1.3 or
    any later version published by the Free Software Foundation; with no
    Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
*/

#ifndef CPPREFERENCE_CSTDIO_H
#define CPPREFERENCE_CSTDIO_H

#define stdin (::std::FILE*)(NULL) // actually a valid pointer
#define stdout (::std::FILE*)(NULL)
#define stderr (::std::FILE*)(NULL)
#define EOR 0
#define FOPEN_MAX 0
#define FILENAME_MAX 0
#define BUFSIZ 0
#define _IOFBF 0
#define _IOLBF 0
#define _IONBF 0
#define SEEK_SET 0
#define SEEK_CUR 0
#define SEEK_END 0
#define TMP_MAX 0
#define L_tmpnam 0

namespace std {

struct FILE;
struct fpos_t;

std::FILE* fopen(const char* filename, const char* mode);
std::FILE* freopen(const char* filename, const char* mode, std::FILE* stream);
int fclose(std::FILE* stream);
int fflush(std::FILE* stream);
int fwide(std::FILE* stream, int mode);
void setbuf(std::FILE* stream, char* buffer);
int setvbuf(std::FILE* stream, char* buffer, int mode, std::size_t size);
std::size_t fread(void* buffer, std::size_t size, std::size_t count, std::FILE* stream);
std::size_t fwrite(const void* buffer, std::size_t size, std::size_t count, std::FILE* stream);
int fgetc(std::FILE* stream);
int getc(std::FILE* stream);
char* fgets(char* str, int count, std::FILE* stream);
int fputc(int ch, std::FILE* stream);
int putc(int ch, std::FILE* stream);
int fputs(const char* str, std::FILE* stream);
int getchar();
int putchar(int ch);
int puts(const char* str);
int ungetc(int ch, std::FILE* stream);

int scanf(const char* format, ...);
int fscanf(std::FILE* stream, const char* format, ...);
int sscanf(const char* buffer, const char* format, ...);

#if CPPREFERENCE_STDVER>= 2011
int vscanf(const char* format, v_list vlist);
int vfscanf(std::FILE* stream, const char* format, va_list vlist);
int vsscanf(const char* buffer, const char* format, va_list vlist);
#endif

int printf(const char* format, ...);
int fprintf(std::FILE* stream, const char* format, ...);
int sprintf(char* buffer, const char* format, ...);
#if CPPREFERENCE_STDVER>= 2011
int snprintf(char* buffer, std::size_t buf_size, const char* format, ...);
#endif

int vprintf(const char* format, va_list vlist);
int vfprintf(std::FILE* stream, const char* format, va_list vlist);
int vsprintf(char* buffer, const char* format, va_list vlist);
#if CPPREFERENCE_STDVER>= 2011
int vsnprintf(char* buffer, std::size_t buf_size, const char* format, va_list vlist);
#endif

long ftell(std::FILE* stream);
int fgetpos(std::FILE* stream, std::fpos_t* pos);
int fseek(std::FILE* stream, long offset, int origin);
int fsetpos(std::FILE* stream, const std::fpos_t* pos);
void rewind(std::FILE* stream);
void clearerr(std::FILE* stream);
int feof(std::FILE* stream);
int ferror(std::FILE* stream);
void perror(const char* s);
int remove(const char* fname);
int rename(const char* old_filename, const char* new_filename);
std::FILE* tmpfile();
char* tmpnam(char* filename);

} // namespace std

#endif // CPPREFERENCE_CSTDIO_H

