1FPURGE(3)                  Linux Programmer's Manual                 FPURGE(3)
2
3
4

NAME

6       fpurge, __fpurge - purge a stream
7

SYNOPSIS

9       /* unsupported */
10       #include <stdio.h>
11
12       int fpurge(FILE *stream);
13
14       /* supported */
15       #include <stdio.h>
16       #include <stdio_ext.h>
17
18       void  __fpurge(FILE *stream);
19

DESCRIPTION

21       The function fpurge() clears the buffers of the given stream.  For out‐
22       put streams this discards any unwritten output.  For input streams this
23       discards any input read from the underlying object but not yet obtained
24       via getc(3); this includes any text pushed  back  via  ungetc(3).   See
25       also fflush(3).
26
27       The  function __fpurge() does precisely the same, but without returning
28       a value.
29

RETURN VALUE

31       Upon successful completion fpurge() returns 0.  On error, it returns -1
32       and sets errno to indicate the error.
33

ERRORS

35       EBADF  stream is not an open stream.
36

ATTRIBUTES

38       For  an  explanation  of  the  terms  used  in  this  section,  see at‐
39       tributes(7).
40
41       ┌────────────────────────────────┬───────────────┬─────────────────────┐
42Interface                       Attribute     Value               
43       ├────────────────────────────────┼───────────────┼─────────────────────┤
44__fpurge()                      │ Thread safety │ MT-Safe race:stream │
45       └────────────────────────────────┴───────────────┴─────────────────────┘
46

CONFORMING TO

48       These  functions  are  nonstandard  and  not  portable.   The  function
49       fpurge()  was  introduced  in  4.4BSD and is not available under Linux.
50       The function __fpurge() was introduced in Solaris, and  is  present  in
51       glibc 2.1.95 and later.
52

NOTES

54       Usually it is a mistake to want to discard input buffers.
55

SEE ALSO

57       fflush(3), setbuf(3), stdio_ext(3)
58

COLOPHON

60       This  page  is  part of release 5.12 of the Linux man-pages project.  A
61       description of the project, information about reporting bugs,  and  the
62       latest     version     of     this    page,    can    be    found    at
63       https://www.kernel.org/doc/man-pages/.
64
65
66
67                                  2021-03-22                         FPURGE(3)
Impressum