1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329
|
'\" et
.TH stdio.h "0P" 2017 "IEEE/The Open Group" "POSIX Programmer's Manual"
.\"
.SH PROLOG
This manual page is part of the POSIX Programmer's Manual.
The Linux implementation of this interface may differ (consult
the corresponding Linux manual page for details of Linux behavior),
or the interface may not be implemented on Linux.
.\"
.SH NAME
stdio.h
\(em standard buffered input/output
.SH SYNOPSIS
.LP
.nf
#include <stdio.h>
.fi
.SH DESCRIPTION
Some of the functionality described on this reference page extends the
ISO\ C standard. Applications shall define the appropriate feature test macro
(see the System Interfaces volume of POSIX.1\(hy2017,
.IR "Section 2.2" ", " "The Compilation Environment")
to enable the visibility of these symbols in this header.
.P
The
.IR <stdio.h>
header shall define the following data types through
.BR typedef :
.IP "\fBFILE\fP" 14
A structure containing information about a file.
.IP "\fBfpos_t\fP" 14
A non-array type containing all information needed to specify uniquely
every position within a file.
.IP "\fBoff_t\fP" 14
As described in
.IR <sys/types.h> .
.IP "\fBsize_t\fP" 14
As described in
.IR <stddef.h> .
.IP "\fBssize_t\fP" 14
As described in
.IR <sys/types.h> .
.IP "\fBva_list\fP" 14
As described in
.IR <stdarg.h> .
.P
The
.IR <stdio.h>
header shall define the following macros which shall expand to
integer constant expressions:
.IP BUFSIZ 14
Size of
.IR <stdio.h>
buffers.
This shall expand to a positive value.
.IP L_ctermid 14
Maximum size of character array to hold
\fIctermid\fR()
output.
.IP L_tmpnam 14
Maximum size of character array to hold
\fItmpnam\fR()
output.
.P
The
.IR <stdio.h>
header shall define the following macros which shall expand to
integer constant expressions with distinct values:
.IP _IOFBF 14
Input/output fully buffered.
.IP _IOLBF 14
Input/output line buffered.
.IP _IONBF 14
Input/output unbuffered.
.P
The
.IR <stdio.h>
header shall define the following macros which shall expand to
integer constant expressions with distinct values:
.IP SEEK_CUR 14
Seek relative to current position.
.IP SEEK_END 14
Seek relative to end-of-file.
.IP SEEK_SET 14
Seek relative to start-of-file.
.P
The
.IR <stdio.h>
header shall define the following macros which shall expand to
integer constant expressions denoting implementation limits:
.IP {FILENAME_MAX} 14
Maximum size in bytes of the longest pathname that the implementation
guarantees can be opened.
.IP {FOPEN_MAX} 14
Number of streams which the implementation guarantees can be open
simultaneously. The value is at least eight.
.IP {TMP_MAX} 14
Minimum number of unique filenames generated by
\fItmpnam\fR().
Maximum number of times an application can call
\fItmpnam\fR()
reliably. The value of
{TMP_MAX}
is at least 25.
.RS 14
.P
On XSI-conformant systems, the value of
{TMP_MAX}
is at least 10\|000.
.RE
.P
The
.IR <stdio.h>
header shall define the following macro which shall expand to an integer
constant expression with type
.BR int
and a negative value:
.IP EOF 14
End-of-file return value.
.P
The
.IR <stdio.h>
header shall define NULL as described in
.IR <stddef.h> .
.br
.P
The
.IR <stdio.h>
header shall define the following macro which shall expand to a
string constant:
.IP P_tmpdir 14
Default directory prefix for
\fItempnam\fR().
.P
The
.IR <stdio.h>
header shall define the following macros which shall expand to
expressions of type ``pointer to
.BR FILE ''
that point to the
.BR FILE
objects associated, respectively, with the standard error, input, and
output streams:
.IP "\fIstderr\fR" 14
Standard error output stream.
.IP "\fIstdin\fR" 14
Standard input stream.
.IP "\fIstdout\fR" 14
Standard output stream.
.P
The following shall be declared as functions and may also be defined as
macros. Function prototypes shall be provided.
.sp
.RS 4
.nf
void clearerr(FILE *);
char *ctermid(char *);
int dprintf(int, const char *restrict, ...)
int fclose(FILE *);
FILE *fdopen(int, const char *);
int feof(FILE *);
int ferror(FILE *);
int fflush(FILE *);
int fgetc(FILE *);
int fgetpos(FILE *restrict, fpos_t *restrict);
char *fgets(char *restrict, int, FILE *restrict);
int fileno(FILE *);
void flockfile(FILE *);
FILE *fmemopen(void *restrict, size_t, const char *restrict);
FILE *fopen(const char *restrict, const char *restrict);
int fprintf(FILE *restrict, const char *restrict, ...);
int fputc(int, FILE *);
int fputs(const char *restrict, FILE *restrict);
size_t fread(void *restrict, size_t, size_t, FILE *restrict);
FILE *freopen(const char *restrict, const char *restrict,
FILE *restrict);
int fscanf(FILE *restrict, const char *restrict, ...);
int fseek(FILE *, long, int);
int fseeko(FILE *, off_t, int);
int fsetpos(FILE *, const fpos_t *);
long ftell(FILE *);
off_t ftello(FILE *);
int ftrylockfile(FILE *);
void funlockfile(FILE *);
size_t fwrite(const void *restrict, size_t, size_t, FILE *restrict);
int getc(FILE *);
int getchar(void);
int getc_unlocked(FILE *);
int getchar_unlocked(void);
ssize_t getdelim(char **restrict, size_t *restrict, int,
FILE *restrict);
ssize_t getline(char **restrict, size_t *restrict, FILE *restrict);
char *gets(char *);
FILE *open_memstream(char **, size_t *);
int pclose(FILE *);
void perror(const char *);
FILE *popen(const char *, const char *);
int printf(const char *restrict, ...);
int putc(int, FILE *);
int putchar(int);
int putc_unlocked(int, FILE *);
int putchar_unlocked(int);
int puts(const char *);
int remove(const char *);
int rename(const char *, const char *);
int renameat(int, const char *, int, const char *);
void rewind(FILE *);
int scanf(const char *restrict, ...);
void setbuf(FILE *restrict, char *restrict);
int setvbuf(FILE *restrict, char *restrict, int, size_t);
int snprintf(char *restrict, size_t, const char *restrict, ...);
int sprintf(char *restrict, const char *restrict, ...);
int sscanf(const char *restrict, const char *restrict, ...);
char *tempnam(const char *, const char *);
FILE *tmpfile(void);
char *tmpnam(char *);
int ungetc(int, FILE *);
int vdprintf(int, const char *restrict, va_list);
int vfprintf(FILE *restrict, const char *restrict, va_list);
int vfscanf(FILE *restrict, const char *restrict, va_list);
int vprintf(const char *restrict, va_list);
int vscanf(const char *restrict, va_list);
int vsnprintf(char *restrict, size_t, const char *restrict,
va_list);
int vsprintf(char *restrict, const char *restrict, va_list);
int vsscanf(const char *restrict, const char *restrict, va_list);
.fi
.P
.RE
.P
Inclusion of the
.IR <stdio.h>
header may also make visible all symbols from
.IR <stddef.h> .
.LP
.IR "The following sections are informative."
.SH "APPLICATION USAGE"
Since standard I/O streams may use an underlying file descriptor to
access the file associated with a stream, application developers need
to be aware that
{FOPEN_MAX}
streams may not be available if file descriptors are being used to access
files that are not associated with streams.
.SH RATIONALE
There is a conflict between the ISO\ C standard and the POSIX definition of the
{TMP_MAX}
macro that is addressed by ISO/IEC\ 9899:\|1999 standard, Defect Report 336. The POSIX standard is
in alignment with the public record of the response to the Defect Report.
This change has not yet been published as part of the ISO\ C standard.
.SH "FUTURE DIRECTIONS"
None.
.SH "SEE ALSO"
.IR "\fB<stdarg.h>\fP",
.IR "\fB<stddef.h>\fP",
.IR "\fB<sys_types.h>\fP"
.P
.ad l
The System Interfaces volume of POSIX.1\(hy2017,
.IR "Section 2.2" ", " "The Compilation Environment",
.IR "\fIclearerr\fR\^(\|)",
.IR "\fIctermid\fR\^(\|)",
.IR "\fIfclose\fR\^(\|)",
.IR "\fIfdopen\fR\^(\|)",
.IR "\fIfeof\fR\^(\|)",
.IR "\fIferror\fR\^(\|)",
.IR "\fIfflush\fR\^(\|)",
.IR "\fIfgetc\fR\^(\|)",
.IR "\fIfgetpos\fR\^(\|)",
.IR "\fIfgets\fR\^(\|)",
.IR "\fIfileno\fR\^(\|)",
.IR "\fIflockfile\fR\^(\|)",
.IR "\fIfmemopen\fR\^(\|)",
.IR "\fIfopen\fR\^(\|)",
.IR "\fIfprintf\fR\^(\|)",
.IR "\fIfputc\fR\^(\|)",
.IR "\fIfputs\fR\^(\|)",
.IR "\fIfread\fR\^(\|)",
.IR "\fIfreopen\fR\^(\|)",
.IR "\fIfscanf\fR\^(\|)",
.IR "\fIfseek\fR\^(\|)",
.IR "\fIfsetpos\fR\^(\|)",
.IR "\fIftell\fR\^(\|)",
.IR "\fIfwrite\fR\^(\|)",
.IR "\fIgetc\fR\^(\|)",
.IR "\fIgetchar\fR\^(\|)",
.IR "\fIgetc_unlocked\fR\^(\|)",
.IR "\fIgetdelim\fR\^(\|)",
.IR "\fIgetopt\fR\^(\|)",
.IR "\fIgets\fR\^(\|)",
.IR "\fIopen_memstream\fR\^(\|)",
.IR "\fIpclose\fR\^(\|)",
.IR "\fIperror\fR\^(\|)",
.IR "\fIpopen\fR\^(\|)",
.IR "\fIputc\fR\^(\|)",
.IR "\fIputchar\fR\^(\|)",
.IR "\fIputs\fR\^(\|)",
.IR "\fIremove\fR\^(\|)",
.IR "\fIrename\fR\^(\|)",
.IR "\fIrewind\fR\^(\|)",
.IR "\fIsetbuf\fR\^(\|)",
.IR "\fIsetvbuf\fR\^(\|)",
.IR "\fIstdin\fR\^",
.IR "\fIsystem\fR\^(\|)",
.IR "\fItempnam\fR\^(\|)",
.IR "\fItmpfile\fR\^(\|)",
.IR "\fItmpnam\fR\^(\|)",
.IR "\fIungetc\fR\^(\|)",
.IR "\fIvfprintf\fR\^(\|)",
.IR "\fIvfscanf\fR\^(\|)"
.ad b
.\"
.SH COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form
from IEEE Std 1003.1-2017, Standard for Information Technology
-- Portable Operating System Interface (POSIX), The Open Group Base
Specifications Issue 7, 2018 Edition,
Copyright (C) 2018 by the Institute of
Electrical and Electronics Engineers, Inc and The Open Group.
In the event of any discrepancy between this version and the original IEEE and
The Open Group Standard, the original IEEE and The Open Group Standard
is the referee document. The original Standard can be obtained online at
http://www.opengroup.org/unix/online.html .
.PP
Any typographical or formatting errors that appear
in this page are most likely
to have been introduced during the conversion of the source files to
man page format. To report such errors, see
https://www.kernel.org/doc/man-pages/reporting_bugs.html .
|