1#
2#Copyright (c) 1990 The Regents of the University of California.
3#All rights reserved.
4#
5#Redistribution and use in source and binary forms are permitted
6#provided that the above copyright notice and this paragraph are
7#duplicated in all such forms and that any documentation,
8#and/or other materials related to such
9#distribution and use acknowledge that the software was developed
10#by the University of California, Berkeley.  The name of the
11#University may not be used to endorse or promote products derived
12#from this software without specific prior written permission.
13#THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14#IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15#WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16#
17@node Stdio
18@chapter Input and Output (@file{stdio.h})
19
20This chapter comprises functions to manage files
21or other input/output streams. Among these functions are subroutines
22to generate or scan strings according to specifications from a format string.
23
24The underlying facilities for input and output depend on the host
25system, but these functions provide a uniform interface.
26
27The corresponding declarations are in @file{stdio.h}.
28
29The reentrant versions of these functions use macros
30
31@example
32_stdin_r(@var{reent})
33_stdout_r(@var{reent})
34_stderr_r(@var{reent})
35@end example
36
37@noindent
38instead of the globals @code{stdin}, @code{stdout}, and
39@code{stderr}.  The argument @var{reent} is a pointer to a reentrancy
40structure.
41
42@menu
43* clearerr::    Clear file or stream error indicator
44* diprintf::    Print to a file descriptor (integer only)
45* dprintf::     Print to a file descriptor
46* fclose::      Close a file
47* fcloseall::   Close all files
48* fdopen::      Turn an open file into a stream
49* feof::        Test for end of file
50* ferror::      Test whether read/write error has occurred
51* fflush::      Flush buffered file output
52* fgetc::       Get a character from a file or stream
53* fgetpos::     Record position in a stream or file
54* fgets::       Get character string from a file or stream
55* fgetwc::      Get a wide character from a file or stream
56* fgetws::      Get a wide character string from a file or stream
57* fileno::      Get file descriptor associated with stream
58* fmemopen::    Open a stream around a fixed-length buffer
59* fopen::       Open a file
60* fopencookie:: Open a stream with custom callbacks
61* fpurge::      Discard all pending I/O on a stream
62* fputc::       Write a character on a stream or file
63* fputs::       Write a character string in a file or stream
64* fputwc::      Write a wide character to a file or stream
65* fputws::      Write a wide character string to a file or stream
66* fread::       Read array elements from a file
67* freopen::     Open a file using an existing file descriptor
68* fseek::       Set file position
69* __fsetlocking::	Set or query locking mode on FILE stream
70* fsetpos::     Restore position of a stream or file
71* ftell::       Return position in a stream or file
72* funopen::     Open a stream with custom callbacks
73* fwide::	Set and determine the orientation of a FILE stream
74* fwrite::      Write array elements from memory to a file or stream
75* getc::        Get a character from a file or stream (macro)
76* getc_unlocked::	Get a character from a file or stream (macro)
77* getchar::     Get a character from standard input (macro)
78* getchar_unlocked::	Get a character from standard input (macro)
79* getdelim::    Get character string from a file or stream
80* getline::     Get character string from a file or stream
81* gets::        Get character string from standard input (obsolete)
82* getw::        Get a word (int) from a file or stream
83* getwchar::    Get a wide character from standard input
84* mktemp::      Generate unused file name
85* open_memstream::	Open a write stream around an arbitrary-length buffer
86* perror::      Print an error message on standard error
87* putc::        Write a character on a stream or file (macro)
88* putc_unlocked::	Write a character on a stream or file (macro)
89* putchar::     Write a character on standard output (macro)
90* putchar_unlocked::	Write a character on standard output (macro)
91* puts::        Write a character string on standard output
92* putw::        Write a word (int) to a file or stream
93* putwchar::    Write a wide character to standard output
94* remove::      Delete a file's name
95* rename::      Rename a file
96* rewind::      Reinitialize a file or stream
97* setbuf::      Specify full buffering for a file or stream
98* setbuffer::   Specify full buffering for a file or stream with size
99* setlinebuf::  Specify line buffering for a file or stream
100* setvbuf::     Specify buffering for a file or stream
101* siprintf::    Write formatted output (integer only)
102* siscanf::     Scan and format input (integer only)
103* sprintf::     Write formatted output
104* sscanf::      Scan and format input
105* stdio_ext::	Access internals of FILE structure
106* swprintf::    Write formatted wide character output
107* swscanf::     Scan and format wide character input
108* tmpfile::     Create a temporary file
109* tmpnam::      Generate name for a temporary file
110* ungetc::      Push data back into a stream
111* ungetwc::     Push wide character data back into a stream
112* vfprintf::    Format variable argument list
113* vfscanf::     Scan variable argument list
114* vfwprintf::   Format variable wide character argument list
115* vfwscanf::    Scan and format argument list from wide character input
116* viprintf::    Format variable argument list (integer only)
117* viscanf::     Scan variable format list (integer only)
118@end menu
119
120@page
121@include stdio/clearerr.def
122
123@page
124@include stdio/diprintf.def
125
126@page
127@include stdio/dprintf.def
128
129@page
130@include stdio/fclose.def
131
132@page
133@include stdio/fcloseall.def
134
135@page
136@include stdio/fdopen.def
137
138@page
139@include stdio/feof.def
140
141@page
142@include stdio/ferror.def
143
144@page
145@include stdio/fflush.def
146
147@page
148@include stdio/fgetc.def
149
150@page
151@include stdio/fgetpos.def
152
153@page
154@include stdio/fgets.def
155
156@page
157@include stdio/fgetwc.def
158
159@page
160@include stdio/fgetws.def
161
162@page
163@include stdio/fileno.def
164
165@page
166@include stdio/fmemopen.def
167
168@page
169@include stdio/fopen.def
170
171@page
172@include stdio/fopencookie.def
173
174@page
175@include stdio/fpurge.def
176
177@page
178@include stdio/fputc.def
179
180@page
181@include stdio/fputs.def
182
183@page
184@include stdio/fputwc.def
185
186@page
187@include stdio/fputws.def
188
189@page
190@include stdio/fread.def
191
192@page
193@include stdio/freopen.def
194
195@page
196@include stdio/fseek.def
197
198@page
199@include stdio/fsetlocking.def
200
201@page
202@include stdio/fsetpos.def
203
204@page
205@include stdio/ftell.def
206
207@page
208@include stdio/funopen.def
209
210@page
211@include stdio/fwide.def
212
213@page
214@include stdio/fwrite.def
215
216@page
217@include stdio/getc.def
218
219@page
220@include stdio/getc_u.def
221
222@page
223@include stdio/getchar.def
224
225@page
226@include stdio/getchar_u.def
227
228@page
229@include stdio/getdelim.def
230
231@page
232@include stdio/getline.def
233
234@page
235@include stdio/gets.def
236
237@page
238@include stdio/getw.def
239
240@page
241@include stdio/getwchar.def
242
243@page
244@include stdio/mktemp.def
245
246@page
247@include stdio/open_memstream.def
248
249@page
250@include stdio/perror.def
251
252@page
253@include stdio/putc.def
254
255@page
256@include stdio/putc_u.def
257
258@page
259@include stdio/putchar.def
260
261@page
262@include stdio/putchar_u.def
263
264@page
265@include stdio/puts.def
266
267@page
268@include stdio/putw.def
269
270@page
271@include stdio/putwchar.def
272
273@page
274@include stdio/remove.def
275
276@page
277@include stdio/rename.def
278
279@page
280@include stdio/rewind.def
281
282@page
283@include stdio/setbuf.def
284
285@page
286@include stdio/setbuffer.def
287
288@page
289@include stdio/setlinebuf.def
290
291@page
292@include stdio/setvbuf.def
293
294@page
295@include stdio/siprintf.def
296
297@page
298@include stdio/siscanf.def
299
300@page
301@include stdio/sprintf.def
302
303@page
304@include stdio/sscanf.def
305
306@page
307@include stdio/stdio_ext.def
308
309@page
310@include stdio/swprintf.def
311
312@page
313@include stdio/swscanf.def
314
315@page
316@include stdio/tmpfile.def
317
318@page
319@include stdio/tmpnam.def
320
321@page
322@include stdio/ungetc.def
323
324@page
325@include stdio/ungetwc.def
326
327@page
328@include stdio/vfprintf.def
329
330@page
331@include stdio/vfscanf.def
332
333@page
334@include stdio/vfwprintf.def
335
336@page
337@include stdio/vfwscanf.def
338
339@page
340@include stdio/viprintf.def
341
342@page
343@include stdio/viscanf.def
344