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
|
<h1 id="firstHeading" class="firstHeading">File input/output</h1> <p>The <code><stdio.h></code> header provides generic file operation support and supplies functions with narrow character input/output capabilities.</p>
<p>The <a href="string/wide" title="c/string/wide"><code><wchar.h></code></a> header supplies functions with wide character input/output capabilities.</p>
<p>I/O streams are denoted by objects of type <code><a href="io/file" title="c/io/FILE">FILE</a></code> that can only be accessed and manipulated through pointers of type <code><a href="http://en.cppreference.com/w/c/io/FILE"><span class="kw884">FILE</span></a><span class="sy2">*</span></code>. Each stream is associated with an external physical device (file, standard input stream, printer, serial port, etc).</p>
<h3 id="Types"> Types</h3> <table class="t-dsc-begin"> <tr class="t-dsc-header"> <th colspan="2"> Defined in header <code><stdio.h></code> </th>
</tr> <tr class="t-dsc"> <td> <div><a href="io/file" title="c/io/FILE"> <span class="t-lines"><span>FILE</span></span></a></div> </td> <td> object type, capable of holding all information needed to control a C I/O stream <br> <span class="t-mark">(typedef)</span> </td>
</tr> <tr class="t-dsc"> <td> <div><a href="io/fpos_t" title="c/io/fpos t"> <span class="t-lines"><span>fpos_t</span></span></a></div> </td> <td> non-array complete object type, capable of uniquely specifying a position and multibyte parser state in a file <br> <span class="t-mark">(typedef)</span> </td>
</tr> </table> <h3 id="Predefined_standard_streams"> Predefined standard streams</h3> <table class="t-dsc-begin"> <tr class="t-dsc-header"> <th colspan="2"> Defined in header <code><stdio.h></code> </th>
</tr> <tr class="t-dsc"> <td> <div><a href="io/std_streams" title="c/io/std streams"> <span class="t-lines"><span>stdin</span><span>stdout</span><span>stderr</span></span></a></div> </td> <td> expression of type <code><a href="http://en.cppreference.com/w/c/io/FILE"><span class="kw884">FILE</span></a><span class="sy2">*</span></code> associated with the input stream<br>expression of type <code><a href="http://en.cppreference.com/w/c/io/FILE"><span class="kw884">FILE</span></a><span class="sy2">*</span></code> associated with the output stream<br>expression of type <code><a href="http://en.cppreference.com/w/c/io/FILE"><span class="kw884">FILE</span></a><span class="sy2">*</span></code> associated with the error output stream <br> <span class="t-mark">(macro constant)</span> </td>
</tr> </table> <h3 id="Functions"> Functions</h3> <table class="t-dsc-begin"> <tr> <td colspan="2"> <h5 id="File_access"> File access </h5> </td>
</tr> <tr class="t-dsc-header"> <th colspan="2"> Defined in header <code><stdio.h></code> </th>
</tr> <tr class="t-dsc"> <td> <div><a href="io/fopen" title="c/io/fopen"> <span class="t-lines"><span>fopen</span><span>fopen_s</span></span></a></div>
<div><span class="t-lines"><span><span class="t-mark-rev t-since-c11">(C11)</span></span></span></div> </td> <td> opens a file <br> <span class="t-mark">(function)</span> </td>
</tr> <tr class="t-dsc"> <td> <div><a href="io/freopen" title="c/io/freopen"> <span class="t-lines"><span>freopen</span><span>freopen_s</span></span></a></div>
<div><span class="t-lines"><span><span class="t-mark-rev t-since-c11">(C11)</span></span></span></div> </td> <td> open an existing stream with a different name <br> <span class="t-mark">(function)</span> </td>
</tr> <tr class="t-dsc"> <td> <div><a href="io/fclose" title="c/io/fclose"> <span class="t-lines"><span>fclose</span></span></a></div> </td> <td> closes a file <br> <span class="t-mark">(function)</span> </td>
</tr> <tr class="t-dsc"> <td> <div><a href="io/fflush" title="c/io/fflush"> <span class="t-lines"><span>fflush</span></span></a></div> </td> <td> synchronizes an output stream with the actual file <br> <span class="t-mark">(function)</span> </td>
</tr> <tr class="t-dsc"> <td> <div><a href="io/setbuf" title="c/io/setbuf"> <span class="t-lines"><span>setbuf</span></span></a></div> </td> <td> sets the buffer for a file stream <br> <span class="t-mark">(function)</span> </td>
</tr> <tr class="t-dsc"> <td> <div><a href="io/setvbuf" title="c/io/setvbuf"> <span class="t-lines"><span>setvbuf</span></span></a></div> </td> <td> sets the buffer and its size for a file stream <br> <span class="t-mark">(function)</span> </td>
</tr> <tr class="t-dsc-header"> <th colspan="2"> Defined in header <code><wchar.h></code> </th>
</tr> <tr class="t-dsc"> <td> <div><a href="io/fwide" title="c/io/fwide"> <span class="t-lines"><span>fwide</span></span></a></div>
<div><span class="t-lines"><span><span class="t-mark-rev t-since-c95">(C95)</span></span></span></div> </td> <td> switches a file stream between wide character I/O and narrow character I/O <br> <span class="t-mark">(function)</span> </td>
</tr> <tr> <td colspan="2"> <h5 id="Direct_input.2Foutput"> Direct input/output </h5> </td>
</tr> <tr class="t-dsc-header"> <th colspan="2"> Defined in header <code><stdio.h></code> </th>
</tr> <tr class="t-dsc"> <td> <div><a href="io/fread" title="c/io/fread"> <span class="t-lines"><span>fread</span></span></a></div> </td> <td> reads from a file <br> <span class="t-mark">(function)</span> </td>
</tr> <tr class="t-dsc"> <td> <div><a href="io/fwrite" title="c/io/fwrite"> <span class="t-lines"><span>fwrite</span></span></a></div> </td> <td> writes to a file <br> <span class="t-mark">(function)</span> </td>
</tr> <tr> <td colspan="2"> <h5 id="Unformatted_input.2Foutput"> Unformatted input/output </h5> </td>
</tr> <tr> <td colspan="2">
<h6 id="Narrow_character"> Narrow character</h6> </td>
</tr> <tr class="t-dsc-header"> <th colspan="2"> Defined in header <code><stdio.h></code> </th>
</tr> <tr class="t-dsc"> <td> <div><a href="io/fgetc" title="c/io/fgetc"> <span class="t-lines"><span>fgetc</span><span>getc</span></span></a></div> </td> <td> gets a character from a file stream <br> <span class="t-mark">(function)</span> </td>
</tr> <tr class="t-dsc"> <td> <div><a href="io/fgets" title="c/io/fgets"> <span class="t-lines"><span>fgets</span></span></a></div> </td> <td> gets a character string from a file stream <br> <span class="t-mark">(function)</span> </td>
</tr> <tr class="t-dsc"> <td> <div><a href="io/fputc" title="c/io/fputc"> <span class="t-lines"><span>fputc</span><span>putc</span></span></a></div> </td> <td> writes a character to a file stream <br> <span class="t-mark">(function)</span> </td>
</tr> <tr class="t-dsc"> <td> <div><a href="io/fputs" title="c/io/fputs"> <span class="t-lines"><span>fputs</span></span></a></div> </td> <td> writes a character string to a file stream <br> <span class="t-mark">(function)</span> </td>
</tr> <tr class="t-dsc"> <td> <div><a href="io/getchar" title="c/io/getchar"> <span class="t-lines"><span>getchar</span></span></a></div> </td> <td> reads a character from <code><a href="io/std_streams" title="c/io/std streams">stdin</a></code> <br> <span class="t-mark">(function)</span> </td>
</tr> <tr class="t-dsc"> <td> <div><a href="io/gets" title="c/io/gets"> <span class="t-lines"><span>gets</span><span>gets_s</span></span></a></div>
<div><span class="t-lines"><span><span class="t-mark-rev t-until-c11">(removed in C11)</span></span><span><span class="t-mark-rev t-since-c11">(C11)</span></span></span></div> </td> <td> reads a character string from <code>stdin</code> <br> <span class="t-mark">(function)</span> </td>
</tr> <tr class="t-dsc"> <td> <div><a href="io/putchar" title="c/io/putchar"> <span class="t-lines"><span>putchar</span></span></a></div> </td> <td> writes a character to <code>stdout</code> <br> <span class="t-mark">(function)</span> </td>
</tr> <tr class="t-dsc"> <td> <div><a href="io/puts" title="c/io/puts"> <span class="t-lines"><span>puts</span></span></a></div> </td> <td> writes a character string to <code><a href="io/std_streams" title="c/io/std streams">stdout</a></code> <br> <span class="t-mark">(function)</span> </td>
</tr> <tr class="t-dsc"> <td> <div><a href="io/ungetc" title="c/io/ungetc"> <span class="t-lines"><span>ungetc</span></span></a></div> </td> <td> puts a character back into a file stream <br> <span class="t-mark">(function)</span> </td>
</tr> <tr> <td colspan="2">
<h6 id="Wide_character"> Wide character</h6> </td>
</tr> <tr class="t-dsc-header"> <th colspan="2"> Defined in header <code><wchar.h></code> </th>
</tr> <tr class="t-dsc"> <td> <div><a href="io/fgetwc" title="c/io/fgetwc"> <span class="t-lines"><span>fgetwc</span><span>getwc</span></span></a></div>
<div><span class="t-lines"><span><span class="t-mark-rev t-since-c95">(C95)</span></span></span></div> </td> <td> gets a wide character from a file stream <br> <span class="t-mark">(function)</span> </td>
</tr> <tr class="t-dsc"> <td> <div><a href="io/fgetws" title="c/io/fgetws"> <span class="t-lines"><span>fgetws</span></span></a></div>
<div><span class="t-lines"><span><span class="t-mark-rev t-since-c95">(C95)</span></span></span></div> </td> <td> gets a wide string from a file stream <br> <span class="t-mark">(function)</span> </td>
</tr> <tr class="t-dsc"> <td> <div><a href="io/fputwc" title="c/io/fputwc"> <span class="t-lines"><span>fputwc</span><span>putwc</span></span></a></div>
<div><span class="t-lines"><span><span class="t-mark-rev t-since-c95">(C95)</span></span></span></div> </td> <td> writes a wide character to a file stream <br> <span class="t-mark">(function)</span> </td>
</tr> <tr class="t-dsc"> <td> <div><a href="io/fputws" title="c/io/fputws"> <span class="t-lines"><span>fputws</span></span></a></div>
<div><span class="t-lines"><span><span class="t-mark-rev t-since-c95">(C95)</span></span></span></div> </td> <td> writes a wide string to a file stream <br> <span class="t-mark">(function)</span> </td>
</tr> <tr class="t-dsc"> <td> <div><a href="io/getwchar" title="c/io/getwchar"> <span class="t-lines"><span>getwchar</span></span></a></div>
<div><span class="t-lines"><span><span class="t-mark-rev t-since-c95">(C95)</span></span></span></div> </td> <td> reads a wide character from <code>stdin</code> <br> <span class="t-mark">(function)</span> </td>
</tr> <tr class="t-dsc"> <td> <div><a href="io/putwchar" title="c/io/putwchar"> <span class="t-lines"><span>putwchar</span></span></a></div>
<div><span class="t-lines"><span><span class="t-mark-rev t-since-c95">(C95)</span></span></span></div> </td> <td> writes a wide character to <code><a href="io/std_streams" title="c/io/std streams">stdout</a></code> <br> <span class="t-mark">(function)</span> </td>
</tr> <tr class="t-dsc"> <td> <div><a href="io/ungetwc" title="c/io/ungetwc"> <span class="t-lines"><span>ungetwc</span></span></a></div>
<div><span class="t-lines"><span><span class="t-mark-rev t-since-c95">(C95)</span></span></span></div> </td> <td> puts a wide character back into a file stream <br> <span class="t-mark">(function)</span> </td>
</tr> <tr> <td colspan="2"> <h5 id="Formatted_input.2Foutput"> Formatted input/output </h5> </td>
</tr> <tr> <td colspan="2">
<h6 id="Narrow_character_2"> Narrow character</h6> </td>
</tr> <tr class="t-dsc-header"> <th colspan="2"> Defined in header <code><stdio.h></code> </th>
</tr> <tr class="t-dsc"> <td> <div><a href="io/fscanf" title="c/io/fscanf"> <span class="t-lines"><span>scanf</span><span>fscanf</span><span>sscanf</span><span>scanf_s</span><span>fscanf_s</span><span>sscanf_s</span></span></a></div>
<div><span class="t-lines"><span><span class="t-mark-rev t-since-c11">(C11)</span></span><span><span class="t-mark-rev t-since-c11">(C11)</span></span><span><span class="t-mark-rev t-since-c11">(C11)</span></span></span></div> </td> <td> reads formatted input from <code><a href="io/std_streams" title="c/io/std streams">stdin</a></code>, a file stream or a buffer <br> <span class="t-mark">(function)</span> </td>
</tr> <tr class="t-dsc"> <td> <div><a href="io/vfscanf" title="c/io/vfscanf"> <span class="t-lines"><span>vscanf</span><span>vfscanf</span><span>vsscanf</span><span>vscanf_s</span><span>vfscanf_s</span><span>vsscanf_s</span></span></a></div>
<div><span class="t-lines"><span><span class="t-mark-rev t-since-c99">(C99)</span></span><span><span class="t-mark-rev t-since-c99">(C99)</span></span><span><span class="t-mark-rev t-since-c99">(C99)</span></span><span><span class="t-mark-rev t-since-c11">(C11)</span></span><span><span class="t-mark-rev t-since-c11">(C11)</span></span><span><span class="t-mark-rev t-since-c11">(C11)</span></span></span></div> </td> <td> reads formatted input from <code><a href="io/std_streams" title="c/io/std streams">stdin</a></code>, a file stream or a buffer<br> using variable argument list <br> <span class="t-mark">(function)</span> </td>
</tr> <tr class="t-dsc"> <td> <div><a href="io/fprintf" title="c/io/fprintf"> <span class="t-lines"><span>printf</span><span>fprintf</span><span>sprintf</span><span>snprintf</span><span>printf_s</span><span>fprintf_s</span><span>sprintf_s</span><span>snprintf_s</span></span></a></div>
<div><span class="t-lines"><span><span class="t-mark-rev t-since-c99">(C99)</span></span><span><span class="t-mark-rev t-since-c11">(C11)</span></span><span><span class="t-mark-rev t-since-c11">(C11)</span></span><span><span class="t-mark-rev t-since-c11">(C11)</span></span><span><span class="t-mark-rev t-since-c11">(C11)</span></span></span></div> </td> <td> prints formatted output to <code><a href="io/std_streams" title="c/io/std streams">stdout</a></code>, a file stream or a buffer <br> <span class="t-mark">(function)</span> </td>
</tr> <tr class="t-dsc"> <td> <div><a href="io/vfprintf" title="c/io/vfprintf"> <span class="t-lines"><span>vprintf</span><span>vfprintf</span><span>vsprintf</span><span>vsnprintf</span><span>vprintf_s</span><span>vfprintf_s</span><span>vsprintf_s</span><span>vsnprintf_s</span></span></a></div>
<div><span class="t-lines"><span><span class="t-mark-rev t-since-c99">(C99)</span></span><span><span class="t-mark-rev t-since-c11">(C11)</span></span><span><span class="t-mark-rev t-since-c11">(C11)</span></span><span><span class="t-mark-rev t-since-c11">(C11)</span></span><span><span class="t-mark-rev t-since-c11">(C11)</span></span></span></div> </td> <td> prints formatted output to <code><a href="io/std_streams" title="c/io/std streams">stdout</a></code>, a file stream or a buffer<br> using variable argument list <br> <span class="t-mark">(function)</span> </td>
</tr> <tr> <td colspan="2">
<h6 id="Wide_character_2"> Wide character</h6> </td>
</tr> <tr class="t-dsc-header"> <th colspan="2"> Defined in header <code><wchar.h></code> </th>
</tr> <tr class="t-dsc"> <td> <div><a href="io/fwscanf" title="c/io/fwscanf"> <span class="t-lines"><span>wscanf</span><span>fwscanf</span><span>swscanf</span><span>wscanf_s</span><span>fwscanf_s</span><span>swscanf_s</span></span></a></div>
<div><span class="t-lines"><span><span class="t-mark-rev t-since-c95">(C95)</span></span><span><span class="t-mark-rev t-since-c95">(C95)</span></span><span><span class="t-mark-rev t-since-c95">(C95)</span></span><span><span class="t-mark-rev t-since-c11">(C11)</span></span><span><span class="t-mark-rev t-since-c11">(C11)</span></span><span><span class="t-mark-rev t-since-c11">(C11)</span></span></span></div> </td> <td> reads formatted wide character input from <code><a href="io/std_streams" title="c/io/std streams">stdin</a></code>, a file stream or a buffer <br> <span class="t-mark">(function)</span> </td>
</tr> <tr class="t-dsc"> <td> <div><a href="io/vfwscanf" title="c/io/vfwscanf"> <span class="t-lines"><span>vwscanf</span><span>vfwscanf</span><span>vswscanf</span><span>vwscanf_s</span><span>vfwscanf_s</span><span>vswscanf_s</span></span></a></div>
<div><span class="t-lines"><span><span class="t-mark-rev t-since-c99">(C99)</span></span><span><span class="t-mark-rev t-since-c99">(C99)</span></span><span><span class="t-mark-rev t-since-c99">(C99)</span></span><span><span class="t-mark-rev t-since-c11">(C11)</span></span><span><span class="t-mark-rev t-since-c11">(C11)</span></span><span><span class="t-mark-rev t-since-c11">(C11)</span></span></span></div> </td> <td> reads formatted wide character input from <code><a href="io/std_streams" title="c/io/std streams">stdin</a></code>, a file stream<br> or a buffer using variable argument list <br> <span class="t-mark">(function)</span> </td>
</tr> <tr class="t-dsc"> <td> <div><a href="io/fwprintf" title="c/io/fwprintf"> <span class="t-lines"><span>wprintf</span><span>fwprintf</span><span>swprintf</span><span>wprintf_s</span><span>fwprintf_s</span><span>swprintf_s</span><span>snwprintf_s</span></span></a></div>
<div><span class="t-lines"><span><span class="t-mark-rev t-since-c95">(C95)</span></span><span><span class="t-mark-rev t-since-c95">(C95)</span></span><span><span class="t-mark-rev t-since-c95">(C95)</span></span><span><span class="t-mark-rev t-since-c11">(C11)</span></span><span><span class="t-mark-rev t-since-c11">(C11)</span></span><span><span class="t-mark-rev t-since-c11">(C11)</span></span><span><span class="t-mark-rev t-since-c11">(C11)</span></span></span></div> </td> <td> prints formatted wide character output to <code><a href="io/std_streams" title="c/io/std streams">stdout</a></code>, a file stream or a buffer <br> <span class="t-mark">(function)</span> </td>
</tr> <tr class="t-dsc"> <td> <div><a href="io/vfwprintf" title="c/io/vfwprintf"> <span class="t-lines"><span>vwprintf</span><span>vfwprintf</span><span>vswprintf</span><span>vwprintf_s</span><span>vfwprintf_s</span><span>vswprintf_s</span><span>vsnwprintf_s</span></span></a></div>
<div><span class="t-lines"><span><span class="t-mark-rev t-since-c95">(C95)</span></span><span><span class="t-mark-rev t-since-c95">(C95)</span></span><span><span class="t-mark-rev t-since-c95">(C95)</span></span><span><span class="t-mark-rev t-since-c11">(C11)</span></span><span><span class="t-mark-rev t-since-c11">(C11)</span></span><span><span class="t-mark-rev t-since-c11">(C11)</span></span><span><span class="t-mark-rev t-since-c11">(C11)</span></span></span></div> </td> <td> prints formatted wide character output to <code><a href="io/std_streams" title="c/io/std streams">stdout</a></code>, a file stream<br> or a buffer using variable argument list <br> <span class="t-mark">(function)</span> </td>
</tr> <tr> <td colspan="2"> <h5 id="File_positioning"> File positioning </h5> </td>
</tr> <tr class="t-dsc-header"> <th colspan="2"> Defined in header <code><stdio.h></code> </th>
</tr> <tr class="t-dsc"> <td> <div><a href="io/ftell" title="c/io/ftell"> <span class="t-lines"><span>ftell</span></span></a></div> </td> <td> returns the current file position indicator <br> <span class="t-mark">(function)</span> </td>
</tr> <tr class="t-dsc"> <td> <div><a href="io/fgetpos" title="c/io/fgetpos"> <span class="t-lines"><span>fgetpos</span></span></a></div> </td> <td> gets the file position indicator <br> <span class="t-mark">(function)</span> </td>
</tr> <tr class="t-dsc"> <td> <div><a href="io/fseek" title="c/io/fseek"> <span class="t-lines"><span>fseek</span></span></a></div> </td> <td> moves the file position indicator to a specific location in a file <br> <span class="t-mark">(function)</span> </td>
</tr> <tr class="t-dsc"> <td> <div><a href="io/fsetpos" title="c/io/fsetpos"> <span class="t-lines"><span>fsetpos</span></span></a></div> </td> <td> moves the file position indicator to a specific location in a file <br> <span class="t-mark">(function)</span> </td>
</tr> <tr class="t-dsc"> <td> <div><a href="io/rewind" title="c/io/rewind"> <span class="t-lines"><span>rewind</span></span></a></div> </td> <td> moves the file position indicator to the beginning in a file <br> <span class="t-mark">(function)</span> </td>
</tr> <tr> <td colspan="2"> <h5 id="Error_handling"> Error handling </h5> </td>
</tr> <tr class="t-dsc-header"> <th colspan="2"> Defined in header <code><stdio.h></code> </th>
</tr> <tr class="t-dsc"> <td> <div><a href="io/clearerr" title="c/io/clearerr"> <span class="t-lines"><span>clearerr</span></span></a></div> </td> <td> clears errors <br> <span class="t-mark">(function)</span> </td>
</tr> <tr class="t-dsc"> <td> <div><a href="io/feof" title="c/io/feof"> <span class="t-lines"><span>feof</span></span></a></div> </td> <td> checks for the end-of-file <br> <span class="t-mark">(function)</span> </td>
</tr> <tr class="t-dsc"> <td> <div><a href="io/ferror" title="c/io/ferror"> <span class="t-lines"><span>ferror</span></span></a></div> </td> <td> checks for a file error <br> <span class="t-mark">(function)</span> </td>
</tr> <tr class="t-dsc"> <td> <div><a href="io/perror" title="c/io/perror"> <span class="t-lines"><span>perror</span></span></a></div> </td> <td> displays a character string corresponding of the current error to <code><a href="io/std_streams" title="c/io/std streams">stderr</a></code> <br> <span class="t-mark">(function)</span> </td>
</tr> <tr> <td colspan="2"> <h5 id="Operations_on_files"> Operations on files </h5> </td>
</tr> <tr class="t-dsc-header"> <th colspan="2"> Defined in header <code><stdio.h></code> </th>
</tr> <tr class="t-dsc"> <td> <div><a href="io/remove" title="c/io/remove"> <span class="t-lines"><span>remove</span></span></a></div> </td> <td> erases a file <br> <span class="t-mark">(function)</span> </td>
</tr> <tr class="t-dsc"> <td> <div><a href="io/rename" title="c/io/rename"> <span class="t-lines"><span>rename</span></span></a></div> </td> <td> renames a file <br> <span class="t-mark">(function)</span> </td>
</tr> <tr class="t-dsc"> <td> <div><a href="io/tmpfile" title="c/io/tmpfile"> <span class="t-lines"><span>tmpfile</span><span>tmpfile_s</span></span></a></div>
<div><span class="t-lines"><span><span class="t-mark-rev t-since-c11">(C11)</span></span></span></div> </td> <td> returns a pointer to a temporary file <br> <span class="t-mark">(function)</span> </td>
</tr> <tr class="t-dsc"> <td> <div><a href="io/tmpnam" title="c/io/tmpnam"> <span class="t-lines"><span>tmpnam</span><span>tmpnam_s</span></span></a></div>
<div><span class="t-lines"><span><span class="t-mark-rev t-since-c11">(C11)</span></span></span></div> </td> <td> returns a unique filename <br> <span class="t-mark">(function)</span> </td>
</tr> </table> <h3 id="Macro_constants"> Macro constants</h3> <table class="t-dsc-begin"> <tr class="t-dsc-header"> <th colspan="2"> Defined in header <code><stdio.h></code> </th>
</tr> <tr class="t-dsc"> <td> <div><span class="t-lines"><span>EOF</span></span></div> </td> <td> integer constant expression of type <code>int</code> and negative value <br> <span class="t-mark">(macro constant)</span> </td>
</tr> <tr class="t-dsc"> <td> <div><span class="t-lines"><span>FOPEN_MAX</span></span></div> </td> <td> maximum number of files that can be open simultaneously <br> <span class="t-mark">(macro constant)</span> </td>
</tr> <tr class="t-dsc"> <td> <div><span class="t-lines"><span>FILENAME_MAX</span></span></div> </td> <td> size needed for an array of <code>char</code> to hold the longest supported file name <br> <span class="t-mark">(macro constant)</span> </td>
</tr> <tr class="t-dsc"> <td> <div><span class="t-lines"><span>BUFSIZ</span></span></div> </td> <td> size of the buffer used by <code><a href="io/setbuf" title="c/io/setbuf">setbuf</a></code> <br> <span class="t-mark">(macro constant)</span> </td>
</tr> <tr class="t-dsc"> <td> <div><span class="t-lines"><span>_IOFBF</span><span>_IOLBF</span><span>_IONBF</span></span></div> </td> <td> argument to <code><a href="io/setvbuf" title="c/io/setvbuf">setvbuf</a></code> indicating fully buffered I/O<br>argument to <code><a href="io/setvbuf" title="c/io/setvbuf">setvbuf</a></code> indicating line buffered I/O<br>argument to <code><a href="io/setvbuf" title="c/io/setvbuf">setvbuf</a></code> indicating unbuffered I/O <br> <span class="t-mark">(macro constant)</span> </td>
</tr> <tr class="t-dsc"> <td> <div><span class="t-lines"><span>SEEK_SET</span><span>SEEK_CUR</span><span>SEEK_END</span></span></div> </td> <td> argument to <code><a href="io/fseek" title="c/io/fseek">fseek</a></code> indicating seeking from beginning of the file<br>argument to <code><a href="io/fseek" title="c/io/fseek">fseek</a></code> indicating seeking from the current file position<br>argument to <code><a href="io/fseek" title="c/io/fseek">fseek</a></code> indicating seeking from end of the file <br> <span class="t-mark">(macro constant)</span> </td>
</tr> <tr class="t-dsc"> <td> <div><span class="t-lines"><span>TMP_MAX</span><span>TMP_MAX_S</span></span></div>
<div><span class="t-lines"><span><span class="t-mark-rev t-since-c11">(C11)</span></span></span></div> </td> <td> maximum number of unique filenames that can be generated by <code><a href="io/tmpnam" title="c/io/tmpnam">tmpnam</a></code><br>maximum number of unique filenames that can be generated by <code>tmpnam_s</code> <br> <span class="t-mark">(macro constant)</span> </td>
</tr> <tr class="t-dsc"> <td> <div><span class="t-lines"><span>L_tmpnam</span><span>L_tmpnam_s</span></span></div>
<div><span class="t-lines"><span><span class="t-mark-rev t-since-c11">(C11)</span></span></span></div> </td> <td> size needed for an array of <code>char</code> to hold the result of <code><a href="io/tmpnam" title="c/io/tmpnam">tmpnam</a></code><br>size needed for an array of <code>char</code> to hold the result of <code>tmpnam_s</code> <br> <span class="t-mark">(macro constant)</span> </td>
</tr> </table> <h3 id="References"> References</h3> <ul>
<li> C23 standard (ISO/IEC 9899:2023): </li>
<ul>
<li> 7.21 Input/output <stdio.h> (p: TBD) </li>
<li> 7.29 Extended multibyte and wide character utilities <wchar.h> (p: TBD) </li>
<li> 7.31.11 Input/output <stdio.h> (p: TBD) </li>
<li> 7.31.16 Extended multibyte and wide character utilities <wchar.h> (p: TBD) </li>
<li> K.3.5 Input/output <stdio.h> (p: TBD) </li>
</ul>
<li> C17 standard (ISO/IEC 9899:2018): </li>
<ul>
<li> 7.21 Input/output <stdio.h> (p: TBD) </li>
<li> 7.29 Extended multibyte and wide character utilities <wchar.h> (p: TBD) </li>
<li> 7.31.11 Input/output <stdio.h> (p: TBD) </li>
<li> 7.31.16 Extended multibyte and wide character utilities <wchar.h> (p: TBD) </li>
<li> K.3.5 Input/output <stdio.h> (p: TBD) </li>
</ul>
<li> C11 standard (ISO/IEC 9899:2011): </li>
<ul>
<li> 7.21 Input/output <stdio.h> (p: 296-339) </li>
<li> 7.29 Extended multibyte and wide character utilities <wchar.h> (p: 402-446) </li>
<li> 7.31.11 Input/output <stdio.h> (p: 456) </li>
<li> 7.31.16 Extended multibyte and wide character utilities <wchar.h> (p: 456) </li>
<li> K.3.5 Input/output <stdio.h> (p: 586-603) </li>
</ul>
<li> C99 standard (ISO/IEC 9899:1999): </li>
<ul>
<li> 7.19 Input/output <stdio.h> (p: 262-305) </li>
<li> 7.24 Extended multibyte and wide character utilities <wchar.h> (p: 348-392) </li>
<li> 7.26.9 Input/output <stdio.h> (p: 402) </li>
<li> 7.26.12 Extended multibyte and wide character utilities <wchar.h> (p: 402) </li>
</ul>
<li> C89/C90 standard (ISO/IEC 9899:1990): </li>
<ul>
<li> 4.9 INPUT/OUTPUT <stdio.h> </li>
<li> 4.13.6 Input/output <stdio.h> </li>
</ul>
</ul> <h3 id="See_also"> See also</h3> <table class="t-dsc-begin"> <tr class="t-dsc"> <td colspan="2"> <span><a href="https://en.cppreference.com/w/cpp/io/c" title="cpp/io/c">C++ documentation</a></span> for <span class=""><span>C-style file input/output</span></span> </td>
</tr> </table> <div class="_attribution">
<p class="_attribution-p">
© cppreference.com<br>Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.<br>
<a href="https://en.cppreference.com/w/c/io" class="_attribution-link">https://en.cppreference.com/w/c/io</a>
</p>
</div>
|