📄 intro.3s
字号:
.\" SCCSID: @(#)intro.3s 8.1 9/11/90.TH intro 3s.SH Namestdio \- standard buffered input/output package.SH Syntax.B #include <stdio.h>.PP.SM.B FILE.B *stdin;.br.SM.B FILE.B *stdout;.br.SM.B FILE.B *stderr;.SH Description.NXR "stdio macro package".NXS "standard buffered input/output package" "stdio macro package"The functions described in section 3s constitute a user-level bufferingscheme. The in-line macros.PN getcand.MS putc 3shandle characters quickly. The higher level routines.PN gets ,.PN fgets ,.PN scanf ,.PN fscanf ,.PN fread ,.PN puts ,.PN fputs ,.PN printf ,.PN fprintf ,.PN fwriteall use.PN getcand.PN putc;they can be freely intermixed..PPA file with associated buffering is called a.IR stream ,and is declared to be a pointer to a defined type.SM FILE..NXR "stream" "defined"The .MS fopen 3ssubroutinecreates certain descriptive data for a streamand returns a pointer to designatethe stream in all further transactions.There are three normally open streams with constant pointers declared inthe include file and associated with the standard open files:.TP 10n.B stdinstandard input file.br.ns.TP.B stdoutstandard output file.br.ns.TP.B stderrstandard error file.PPA constant `pointer' NULL (0) designates no stream at all..PPAn integer constant EOF(\-1) is returned upon end of file or error by integer functions thatdeal with streams..PPAny routine that uses the standard input/output packagemust include the header file <stdio.h>of pertinent macro definitions.The functions and constants mentioned in sections labeled 3Sare declared in the include file and need no further declaration.The constants, and the following `functions' areimplemented as macros; redeclaration of these names is perilous:.PN getc ,.PN getchar ,.PN putc ,.PN putchar ,.PN feof ,.PN ferror ,.PN fileno ..NT "VAX Only"On VAX machines, the GFLOAT version of.IR libcis used when you use the .MS cc 1command with the .B \-Mgoption, or you use the .MS ld 1command with the .B \-lcgoption.The GFLOAT version of.IR libcmust be used with modules compiled with .MS cc 1 using the.B \-Mgoption. .spAlso note that neither the compiler nor the linker .MS ld 1can detect when mixed double floating point typesare used, and the program may produce erroneousresults if this occurs on VAX machines..NE.SH System V CompatibilityThis library contains System V compatibility features thatare available to general ULTRIX programs. For a discussion of howthese features are documented, and how to specify that theSystem V environment is to be used in compiling and linkingyour programs, see .MS intro 3 ..SH Diagnostics.NXR "stdio macro package" "diagnostics"The value EOFis returned uniformly to indicate that a FILEpointer has not been initialized with.PN fopen ,input (output) has been attempted on an output (input) stream, or aFILE pointer designates corrupt or otherwise unintelligibleFILE data..PPFor purposes of efficiency, this implementation of the standard libraryhas been changed to line bufferoutput to a terminal by default and attemptsto do this transparently by flushing the output whenever a .MS read 2from the standard input is necessary.This is almost always transparent,but may cause confusion or malfunctioning of programs which usestandard I/O routines but use .MS read 2themselves to read from the standard input..PPIn cases where a large amount of computation is done after printingpart of a line on an output terminal, it is necessary to .MS fflush 3sthe standard output before going off and computing so that the outputwill appear..SH Files.nf/lib/libc.a/usr/lib/libcg.a (VAX only).fi.SH See Alsoopen(2), close(2), read(2), write(2), fread(3s), fseek(3s), ferror(3s),fclose(3s), fopen(3s)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -