Penguin
Annotated edit history of stdio(3) version 1, including all changes. View license author blame.
Rev Author # Line
1 perry 1 STDIO
2 !!!STDIO
3 NAME
4 SYNOPSIS
5 DESCRIPTION
6 SEE ALSO
7 BUGS
8 CONFORMING TO
9 LIST OF FUNCTIONS
10 ----
11 !!NAME
12
13
14 stdio - standard input/output library functions
15 !!SYNOPSIS
16
17
18 __#include __
19
20
21 __FILE *stdin;
22 FILE *stdout;
23 FILE *stderr;__
24 !!DESCRIPTION
25
26
27 The standard I/O library provides a simple and efficient
28 buffered stream I/O interface. Input and output is mapped
29 into logical data streams and the physical I/O
30 characteristics are concealed. The functions and macros are
31 listed below; more information is available from the
32 individual man pages.
33
34
35 A stream is associated with an external file (which may be a
36 physical device) by ''opening'' a file, which may involve
37 creating a new file. Creating an existing file causes its
38 former contents to be discarded. If a file can support
39 positioning requests (such as a disk file, as opposed to a
40 terminal) then a ''file position indicator'' associated
41 with the stream is positioned at the start of the file (byte
42 zero), unless the file is opened with append mode. If append
43 mode is used, the position indicator will be placed the
44 end-of-file. The position indicator is maintained by
45 subsequent reads, writes and positioning requests. All input
46 occurs as if the characters were read by successive calls to
47 the fgetc(3) function; all output takes place as if
48 all characters were read by successive calls to the
49 fputc(3) function.
50
51
52 A file is disassociated from a stream by ''closing'' the
53 file. Output streams are flushed (any unwritten buffer
54 contents are transferred to the host environment) before the
55 stream is disassociated from the file. The value of a
56 pointer to a __FILE__ object is indeterminate after a
57 file is closed (garbage).
58
59
60 A file may be subsequently reopened, by the same or another
61 program execution, and its contents reclaimed or modified
62 (if it can be repositioned at the start). If the main
63 function returns to its original caller, or the
64 exit(3) function is called, all open files are closed
65 (hence all output streams are flushed) before program
66 termination. Other methods of program termination, such as
67 abort(3) do not bother about closing files
68 properly.
69
70
71 At program startup, three text streams are predefined and
72 need not be opened explicitly -- ''standard input'' (for
73 reading conventional input), -- ''standard output'' (for
74 writing conventional input), and ''standard error'' (for
75 writing diagnostic output). These streams are abbreviated
76 ''stdin'',''stdout'' and ''stderr''. When opened,
77 the standard error stream is not fully buffered; the
78 standard input and output streams are fully buffered if and
79 only if the streams do not to refer to an interactive
80 device.
81
82
83 Output streams that refer to terminal devices are always
84 line buffered by default; pending output to such streams is
85 written automatically whenever an input stream that refers
86 to a terminal device is read. In cases where a large amount
87 of computation is done after printing part of a line on an
88 output terminal, it is necessary to fflush(3) the
89 standard output before going off and computing so that the
90 output will appear.
91
92
93 The __stdio__ library is a part of the library
94 __libc__ and routines are automatically loaded as needed
95 by the compilers cc(1) and pc(1). The
96 __SYNOPSIS__ sections of the following manual pages
97 indicate which include files are to be used, what the
98 compiler declaration for the function looks like and which
99 external variables are of interest.
100
101
102 The following are defined as macros; these names may not be
103 re-used without first removing their current definitions
104 with __#undef__: __BUFSIZ__, __EOF__,
105 __FILENAME_MAX__, __FOPEN_MAX__, __L_cuserid__,
106 __L_ctermid__, __L_tmpnam, NULL__, __SEEK_END__,
107 __SEEK_SET__, __SEE_CUR__, __TMP_MAX__,
108 __clearerr__, __feof__, __ferror__, __fileno__,
109 __fropen__, __fwopen__, __getc__, __getchar__,
110 __putc__, __putchar__, __stderr__, __stdin__,
111 __stdout__. Function versions of the macro functions
112 __feof__, __ferror__, __clearerr__, __fileno__,
113 __getc__, __getchar__, __putc__, and __putchar__
114 exist and will be used if the macros definitions are
115 explicitly removed.
116 !!SEE ALSO
117
118
119 open(2), close(2), read(2),
120 write(2), stdout(3)
121 !!BUGS
122
123
124 The standard buffered functions do not interact well with
125 certain other library and system functions, especially
126 __vfork__ and __abort__. This may not be the case
127 under Linux.
128 !!CONFORMING TO
129
130
131 The __stdio__ library conforms to ANSI X3.159-1989
132 (``ANSI C'').
133 !!LIST OF FUNCTIONS
134
135
136 __Function__
137
138
139 __Description__
140
141
142 clearerr
143
144
145 check and reset stream status
146
147
148 fclose
149
150
151 close a stream
152
153
154 fdopen
155
156
157 stream open functions
158
159
160 feof
161
162
163 check and reset stream status
164
165
166 ferror
167
168
169 check and reset stream status
170
171
172 fflush
173
174
175 flush a stream
176
177
178 fgetc
179
180
181 get next character or word from input stream
182
183
184 fgetpos
185
186
187 reposition a stream
188
189
190 fgets
191
192
193 get a line from a stream
194
195
196 fileno
197
198
199 check and reset stream status
200
201
202 fopen
203
204
205 stream open functions
206
207
208 fprintf
209
210
211 formatted output conversion
212
213
214 fpurge
215
216
217 flush a stream
218
219
220 fputc
221
222
223 output a character or word to a stream
224
225
226 fputs
227
228
229 output a line to a stream
230
231
232 fread
233
234
235 binary stream input/output
236
237
238 freopen
239
240
241 stream open functions
242
243
244 fropen
245
246
247 open a stream
248
249
250 fscanf
251
252
253 input format conversion
254
255
256 fseek
257
258
259 reposition a stream
260
261
262 fsetpos
263
264
265 reposition a stream
266
267
268 ftell
269
270
271 reposition a stream
272
273
274 fwrite
275
276
277 binary stream input/output
278
279
280 getc
281
282
283 get next character or word from input stream
284
285
286 getchar
287
288
289 get next character or word from input stream
290
291
292 gets
293
294
295 get a line from a stream
296
297
298 getw
299
300
301 get next character or word from input stream
302
303
304 mktemp
305
306
307 make temporary file name (unique)
308
309
310 perror
311
312
313 system error messages
314
315
316 printf
317
318
319 formatted output conversion
320
321
322 putc
323
324
325 output a character or word to a stream
326
327
328 putchar
329
330
331 output a character or word to a stream
332
333
334 puts
335
336
337 output a line to a stream
338
339
340 putw
341
342
343 output a character or word to a stream
344
345
346 remove
347
348
349 remove directory entry
350
351
352 rewind
353
354
355 reposition a stream
356
357
358 scanf
359
360
361 input format conversion
362
363
364 setbuf
365
366
367 stream buffering operations
368
369
370 setbuffer
371
372
373 stream buffering operations
374
375
376 setlinebuf
377
378
379 stream buffering operations
380
381
382 setvbuf
383
384
385 stream buffering operations
386
387
388 sprintf
389
390
391 formatted output conversion
392
393
394 sscanf
395
396
397 input format conversion
398
399
400 strerror
401
402
403 system error messages
404
405
406 sys_errlist
407
408
409 system error messages
410
411
412 sys_nerr
413
414
415 system error messages
416
417
418 tempnam
419
420
421 temporary file routines
422
423
424 tmpfile
425
426
427 temporary file routines
428
429
430 tmpnam
431
432
433 temporary file routines
434
435
436 ungetc
437
438
439 un-get character from input stream
440
441
442 vfprintf
443
444
445 formatted output conversion
446
447
448 vfscanf
449
450
451 input format conversion
452
453
454 vprintf
455
456
457 formatted output conversion
458
459
460 vscanf
461
462
463 input format conversion
464
465
466 vsprintf
467
468
469 formatted output conversion
470
471
472 vsscanf
473
474
475 input format conversion
476 ----
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.