◐ Shell
reader mode source ↗
From cppreference.com
< c | header

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

Types

object type, capable of holding all information needed to control a C I/O stream
(typedef) [edit]
non-array complete object type, capable of uniquely specifying a position and multibyte parser state in a file
(typedef) [edit]

Predefined standard streams

expression of type FILE* associated with the input stream
expression of type FILE* associated with the output stream
expression of type FILE* associated with the error output stream
(macro constant) [edit]

Functions

File access
opens a file
(function) [edit]
open an existing stream with a different name
(function) [edit]
closes a file
(function) [edit]
synchronizes an output stream with the actual file
(function) [edit]
sets the buffer for a file stream
(function) [edit]
sets the buffer and its size for a file stream
(function) [edit]
Direct input/output
reads from a file
(function) [edit]
writes to a file
(function) [edit]
Unformatted input/output
Narrow character
gets a character from a file stream
(function) [edit]
gets a character string from a file stream
(function) [edit]
writes a character to a file stream
(function) [edit]
writes a character string to a file stream
(function) [edit]
reads a character from stdin
(function) [edit]
(removed in C11)(C11)
reads a character string from stdin
(function) [edit]
writes a character to stdout
(function) [edit]
writes a character string to stdout
(function) [edit]
puts a character back into a file stream
(function) [edit]
Formatted input/output
Narrow character
reads formatted input from stdin, a file stream or a buffer
(function) [edit]
reads formatted input from stdin, a file stream or a buffer
using variable argument list
(function) [edit]
prints formatted output to stdout, a file stream or a buffer
(function) [edit]
prints formatted output to stdout, a file stream or a buffer
using variable argument list
(function) [edit]
File positioning
returns the current file position indicator
(function) [edit]
gets the file position indicator
(function) [edit]
moves the file position indicator to a specific location in a file
(function) [edit]
moves the file position indicator to a specific location in a file
(function) [edit]
moves the file position indicator to the beginning in a file
(function) [edit]
Error handling
clears errors
(function) [edit]
checks for the end-of-file
(function) [edit]
checks for a file error
(function) [edit]
displays a character string corresponding of the current error to stderr
(function) [edit]
Operations on files
erases a file
(function) [edit]
renames a file
(function) [edit]
returns a pointer to a temporary file
(function) [edit]
returns a unique filename
(function) [edit]

Macro constants

EOF
integer constant expression of type int and negative value
(macro constant)
FOPEN_MAX
maximum number of files that can be open simultaneously
(macro constant)
FILENAME_MAX
size needed for an array of char to hold the longest supported file name
(macro constant)
_PRINTF_NAN_LEN_MAX
(C23)
the maximum number of characters output for any (possibly negated) NaN value
(macro constant)
BUFSIZ
size of the buffer used by setbuf
(macro constant)
_IOFBF_IOLBF_IONBF
indicates the buffering mode (fully buffered / line buffered / unbuffered) to be set by setvbuf
(macro constant)
SEEK_SETSEEK_CURSEEK_END
indicates the offset origin (beginning / current position / end) to be used by fseek
(macro constant)
TMP_MAXTMP_MAX_S
(C11)
maximum number of unique filenames that can be generated by tmpnam / tmpnam_s
(macro constant)
L_tmpnamL_tmpnam_s
(C11)
size needed for an array of char to hold the result of tmpnam / tmpnam_s
(macro constant)

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