Annotation of cci/usr/src/man/man3/setbuf.3s, revision 1.1

1.1     ! root        1: .TH SETBUF 3S  "19 January 1983"
        !             2: .UC 4
        !             3: .SH NAME
        !             4: setbuf, setbuffer, setlinebuf \- assign buffering to a stream
        !             5: .SH SYNOPSIS
        !             6: .B #include <stdio.h>
        !             7: .PP
        !             8: .B setbuf(stream, buf)
        !             9: .br
        !            10: .SM
        !            11: .B FILE
        !            12: .B *stream;
        !            13: .br
        !            14: .B char *buf;
        !            15: .PP
        !            16: .B setbuffer(stream, buf, size)
        !            17: .br
        !            18: .SM
        !            19: .B FILE
        !            20: .B *stream;
        !            21: .br
        !            22: .B char *buf;
        !            23: .br
        !            24: .B int size;
        !            25: .PP
        !            26: .B setlinebuf(stream)
        !            27: .br
        !            28: .SM
        !            29: .B FILE
        !            30: .B *stream;
        !            31: .SH DESCRIPTION
        !            32: The three types of buffering available are unbuffered, block buffered,
        !            33: and line buffered.
        !            34: When an output stream is unbuffered, information appears on the
        !            35: destination file or terminal as soon as written;
        !            36: when it is block buffered many characters are saved up and written as a block;
        !            37: when it is line buffered characters are saved up until a newline is
        !            38: encountered or input is read from stdin.
        !            39: .I Fflush
        !            40: (see 
        !            41: .IR fclose (3S))
        !            42: may be used to force the block out early.
        !            43: Normally all files are block buffered.
        !            44: A buffer is obtained from
        !            45: .IR  malloc (3)
        !            46: upon the first
        !            47: .I getc
        !            48: or
        !            49: .IR  putc (3S)
        !            50: on the file.
        !            51: If the standard stream
        !            52: .B stdout
        !            53: refers to a terminal it is line buffered.
        !            54: The standard stream
        !            55: .B stderr
        !            56: is always unbuffered.
        !            57: .PP
        !            58: .I Setbuf
        !            59: is used after a stream has been opened but before it is read or written.
        !            60: The character array
        !            61: .I buf
        !            62: is used instead of an automatically allocated buffer.  If
        !            63: .I buf
        !            64: is the constant pointer
        !            65: .SM
        !            66: .B NULL,
        !            67: input/output will be completely unbuffered.
        !            68: A manifest constant 
        !            69: .SM
        !            70: .B BUFSIZ
        !            71: tells how big an array is needed:
        !            72: .IP
        !            73: .B char
        !            74: buf[BUFSIZ];
        !            75: .PP
        !            76: .IR Setbuffer ,
        !            77: an alternate form of 
        !            78: .IR setbuf ,
        !            79: is used after a stream has been opened but before it is read or written.
        !            80: The character array
        !            81: .I buf
        !            82: whose size is determined by the 
        !            83: .I size
        !            84: argument is used instead of an automatically allocated buffer.  If
        !            85: .I buf
        !            86: is the constant pointer
        !            87: .SM
        !            88: .BR NULL ,
        !            89: input/output will be completely unbuffered.
        !            90: .PP
        !            91: .I Setlinebuf
        !            92: is used to change
        !            93: .I stdout
        !            94: or
        !            95: .I stderr
        !            96: from block buffered or unbuffered to line buffered.
        !            97: Unlike
        !            98: .I setbuf
        !            99: and
        !           100: .I setbuffer
        !           101: it can be used at any time that the file descriptor is active.
        !           102: .PP
        !           103: A file can be changed from unbuffered or line buffered to block buffered
        !           104: by using
        !           105: .I freopen
        !           106: (see
        !           107: .IR fopen (3S)).
        !           108: A file can be changed from block buffered or line buffered to unbuffered
        !           109: by using
        !           110: .I freopen
        !           111: followed by
        !           112: .I setbuf
        !           113: with a buffer argument of 
        !           114: .SM
        !           115: .BR NULL .
        !           116: .SH "SEE ALSO"
        !           117: fopen(3S),
        !           118: getc(3S),
        !           119: putc(3S),
        !           120: malloc(3),
        !           121: fclose(3S),
        !           122: puts(3S),
        !           123: printf(3S),
        !           124: fread(3S)
        !           125: .SH BUGS
        !           126: The standard error stream should be line buffered by default.
        !           127: .LP
        !           128: The
        !           129: .I setbuffer
        !           130: and
        !           131: .I setlinebuf
        !           132: functions are not portable to non 4.2 BSD versions of UNIX.

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.