27 Input/output library [input.output]

27.9 File-based streams [file.streams]

27.9.2 C library files [c.files]

Table [tab:iostreams.hdr.cstdio] describes header <cstdio>. [ Note: C++ does not define the function gets.  — end note ]

Table 134 — Header <cstdio> synopsis
TypeName(s)
Macros:
BUFSIZ FOPEN_MAX SEEK_CUR TMP_MAX _IONBF stdout
EOF L_tmpnam SEEK_END _IOFBF stderr
FILENAME_MAX NULL <cstdio> SEEK_SET _IOLBF stdin
Types: FILE fpos_t size_t <cstdio>
Functions:
clearerr fopen fsetpos putchar snprintf vscanf
fclose fprintf ftell puts sprintf vsnprintf
feof fputc fwrite remove sscanf vsprintf
ferror fputs getc rename tmpfile vsscanf
fflush fread getchar rewind tmpnam
fgetc freopen perror scanf ungetc
fgetpos fscanf printf setbuf vfprintf
fgets fseek putc setvbuf vprintf

Calls to the function tmpnam with an argument of NULL may introduce a data race ([res.on.data.races]) with other calls to tmpnam with an argument of NULL.

See also: ISO C 7.9, Amendment 1 4.6.2.

Table [tab:iostreams.hdr.cinttypes] describes header <cinttypes>. [ Note: The macros defined by <cinttypes> are provided unconditionally. In particular, the symbol __STDC_FORMAT_MACROS, mentioned in footnote 182 of the C standard, plays no role in C++.  — end note ]

Table 135 — Header <cinttypes> synopsis
TypeName(s)
Macros:
PRI{d i o u x X}[FAST LEAST]{8 16 32 64}
PRI{d i o u x X}{MAX PTR}
SCN{d i o u x X}[FAST LEAST]{8 16 32 64}
SCN{d i o u x X}{MAX PTR}
Types: imaxdiv_t
Functions:
abs imaxabs strtoimax wcstoimax
div imaxdiv strtoumax wcstoumax

The contents of header <cinttypes> are the same as the Standard C Library header <inttypes.h>, with the following changes:

  • the header <cinttypes> includes the header <cstdint> instead of <stdint.h>, and

  • if and only if the type intmax_t designates an extended integer type ([basic.fundamental]), the following function signatures are added:

    intmax_t abs(intmax_t);
    imaxdiv_t div(intmax_t, intmax_t);
    

    which shall have the same semantics as the function signatures intmax_t imaxabs(intmax_t) and imaxdiv_t imaxdiv(intmax_t, intmax_t), respectively.