Standard library header <stdio.h> - cppreference.com (original) (raw)

This header is part of input/output library, providing generic file operation support and supplies I/O functions that work with narrow characters.

[edit] Synopsis

#define STDC_VERSION_STDIO_H 202311L   typedef /* see description / FILE; typedef / see description / size_t; typedef / see description / FILE; typedef / see description / fpos_t;   #define NULL / see description / #define _IOFBF / see description / #define _IOLBF / see description / #define _IONBF / see description / #define BUFSIZ / see description / #define EOF / see description / #define FOPEN_MAX / see description / #define FILENAME_MAX / see description / #define L_tmpnam / see description / #define SEEK_CUR / see description / #define SEEK_END / see description / #define SEEK_SET / see description / #define TMP_MAX / see description /   #define stdin / see description / #define stdout / see description / #define stderr / see description /   #define _PRINTF_NAN_LEN_MAX / see description /   int remove(const char filename); int rename(const char* old, const char* new); FILE* tmpfile(void); char* tmpnam(char* s); int fclose(FILE* stream); int fflush(FILE* stream); FILE* fopen(const char* restrict filename, const char* restrict mode); FILE* freopen(const char* restrict filename, const char* restrict mode, FILE* restrict stream); void setbuf(FILE* restrict stream, char* restrict buf); int setvbuf(FILE* restrict stream, char* restrict buf, int mode, size_t size); int printf(const char* restrict format, ...); int scanf(const char* restrict format, ...); int snprintf(char* restrict s, size_t n, const char* restrict format, ...); int sprintf(char* restrict s, const char* restrict format, ...); int sscanf(const char* restrict s, const char* restrict format, ...); int vfprintf(FILE* restrict stream, const char* restrict format, va_list arg); int vfscanf(FILE* restrict stream, const char* restrict format, va_list arg); int vprintf(const char* restrict format, va_list arg); int vscanf(const char* restrict format, va_list arg); int vsnprintf(char* restrict s, size_t n, const char* restrict format, va_list arg); int vsprintf(char* restrict s, const char* restrict format, va_list arg); int vsscanf(const char* restrict s, const char* restrict format, va_list arg); int fgetc(FILE* stream); char* fgets(char* restrict s, int n, FILE* restrict stream); int fputc(int c, FILE* stream); int fputs(const char* restrict s, FILE* restrict stream); int getc(FILE* stream); int getchar(void); int putc(int c, FILE* stream); int putchar(int c); int puts(const char* s); int ungetc(int c, FILE* stream); size_t fread(void* restrict ptr, size_t size, size_t nmemb, FILE* restrict stream); size_t fwrite(const void* restrict ptr, size_t size, size_t nmemb, FILE* restrict stream); int fgetpos(FILE* restrict stream, fpos_t* restrict pos); int fseek(FILE* stream, long int offset, int whence); int fsetpos(FILE* stream, const fpos_t* pos); long int ftell(FILE* stream); void rewind(FILE* stream); void clearerr(FILE* stream); int feof(FILE* stream); int ferror(FILE* stream); void perror(const char* s); int fprintf(FILE* restrict stream, const char* restrict format, ...); int fscanf(FILE* restrict stream, const char* restrict format, ...);

Only if the implementation defines __STDC_LIB_EXT1__ and additionally the user code defines __STDC_WANT_LIB_EXT1__ before any inclusion of <stdio.h>:

#if defined(STDC_WANT_LIB_EXT1)   #define L_tmpnam_s /* see description / #define TMP_MAX_S / see description /   typedef / see description / errno_t; typedef / see description / rsize_t;   errno_t tmpfile_s(FILE restrict* restrict streamptr); errno_t tmpnam_s(char* s, rsize_t maxsize); errno_t fopen_s(FILE* restrict* restrict streamptr, const char* restrict filename, const char* restrict mode); errno_t freopen_s(FILE* restrict* restrict newstreamptr, const char* restrict filename, const char* restrict mode, FILE* restrict stream); int fprintf_s(FILE* restrict stream, const char* restrict format, ...); int fscanf_s(FILE* restrict stream, const char* restrict format, ...); int printf_s(const char* restrict format, ...); int scanf_s(const char* restrict format, ...); int snprintf_s(char* restrict s, rsize_t n, const char* restrict format, ...); int sprintf_s(char* restrict s, rsize_t n, const char* restrict format, ...); int sscanf_s(const char* restrict s, const char* restrict format, ...); int vfprintf_s(FILE* restrict stream, const char* restrict format, va_list arg); int vfscanf_s(FILE* restrict stream, const char* restrict format, va_list arg); int vprintf_s(const char* restrict format, va_list arg); int vscanf_s(const char* restrict format, va_list arg); int vsnprintf_s(char* restrict s, rsize_t n, const char* restrict format, va_list arg); int vsprintf_s(char* restrict s, rsize_t n, const char* restrict format, va_list arg); int vsscanf_s(const char* restrict s, const char* restrict format, va_list arg); char* gets_s(char* s, rsize_t n); #endif