1SETBUF(3P)                 POSIX Programmer's Manual                SETBUF(3P)
2
3
4

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10
11

NAME

13       setbuf — assign buffering to a stream
14

SYNOPSIS

16       #include <stdio.h>
17
18       void setbuf(FILE *restrict stream, char *restrict buf);
19

DESCRIPTION

21       The functionality described on this reference page is aligned with  the
22       ISO C  standard.  Any  conflict between the requirements described here
23       and the ISO C standard is unintentional. This  volume  of  POSIX.1‐2008
24       defers to the ISO C standard.
25
26       Except that it returns no value, the function call:
27
28           setbuf(stream, buf)
29
30       shall be equivalent to:
31
32           setvbuf(stream, buf, _IOFBF, BUFSIZ)
33
34       if buf is not a null pointer, or to:
35
36           setvbuf(stream, buf, _IONBF, BUFSIZ)
37
38       if buf is a null pointer.
39

RETURN VALUE

41       The setbuf() function shall not return a value.
42

ERRORS

44       Although  the  setvbuf()  interface  may set errno in defined ways, the
45       value of errno after a call to setbuf() is unspecified.
46
47       The following sections are informative.
48

EXAMPLES

50       None.
51

APPLICATION USAGE

53       A common source of error is allocating buffer space as an ``automatic''
54       variable  in  a code block, and then failing to close the stream in the
55       same block.
56
57       With setbuf(), allocating a buffer of BUFSIZ bytes does not necessarily
58       imply that all of BUFSIZ bytes are used for the buffer area.
59
60       Since  errno  is  not  required to be unchanged on success, in order to
61       correctly detect and possibly recover from errors, applications  should
62       use setvbuf() instead of setbuf().
63

RATIONALE

65       None.
66

FUTURE DIRECTIONS

68       None.
69

SEE ALSO

71       Section 2.5, Standard I/O Streams, fopen(), setvbuf()
72
73       The Base Definitions volume of POSIX.1‐2008, <stdio.h>
74
76       Portions  of  this text are reprinted and reproduced in electronic form
77       from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
78       --  Portable  Operating  System  Interface (POSIX), The Open Group Base
79       Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
80       cal  and  Electronics  Engineers,  Inc  and  The  Open Group.  (This is
81       POSIX.1-2008 with the 2013 Technical Corrigendum  1  applied.)  In  the
82       event of any discrepancy between this version and the original IEEE and
83       The Open Group Standard, the original IEEE and The Open Group  Standard
84       is  the  referee document. The original Standard can be obtained online
85       at http://www.unix.org/online.html .
86
87       Any typographical or formatting errors that appear  in  this  page  are
88       most likely to have been introduced during the conversion of the source
89       files to man page format. To report such errors,  see  https://www.ker
90       nel.org/doc/man-pages/reporting_bugs.html .
91
92
93
94IEEE/The Open Group                  2013                           SETBUF(3P)
Impressum