1UNGETC(3P)                 POSIX Programmer's Manual                UNGETC(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

NAME

12       ungetc - push byte back into input stream
13

SYNOPSIS

15       #include <stdio.h>
16
17       int ungetc(int c, FILE *stream);
18
19

DESCRIPTION

21       The ungetc() function shall push the byte specified by c (converted  to
22       an  unsigned char) back onto the input stream pointed to by stream. The
23       pushed-back bytes shall be returned by subsequent reads on that  stream
24       in  the  reverse  order of their pushing. A successful intervening call
25       (with the stream pointed to by stream) to a file-positioning function (
26       fseek(),  fsetpos(),  or  rewind()) shall discard any pushed-back bytes
27       for the stream. The external storage corresponding to the stream  shall
28       be unchanged.
29
30       One byte of push-back shall be provided. If ungetc() is called too many
31       times on the same stream without an intervening read or  file-position‐
32       ing operation on that stream, the operation may fail.
33
34       If  the  value  of  c equals that of the macro EOF, the operation shall
35       fail and the input stream shall be left unchanged.
36
37       A successful call to ungetc() shall clear the end-of-file indicator for
38       the  stream.  The  value  of the file-position indicator for the stream
39       after reading or discarding all pushed-back bytes shall be the same  as
40       it  was  before the bytes were pushed back. The file-position indicator
41       is decremented by each successful call to ungetc(); if its value was  0
42       before a call, its value is unspecified after the call.
43

RETURN VALUE

45       Upon  successful completion, ungetc() shall return the byte pushed back
46       after conversion. Otherwise, it shall return EOF.
47

ERRORS

49       No errors are defined.
50
51       The following sections are informative.
52

EXAMPLES

54       None.
55

APPLICATION USAGE

57       None.
58

RATIONALE

60       None.
61

FUTURE DIRECTIONS

63       None.
64

SEE ALSO

66       fseek(), getc(), fsetpos(), read(), rewind(), setbuf(), the Base  Defi‐
67       nitions volume of IEEE Std 1003.1-2001, <stdio.h>
68
70       Portions  of  this text are reprinted and reproduced in electronic form
71       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
72       --  Portable  Operating  System  Interface (POSIX), The Open Group Base
73       Specifications Issue 6, Copyright (C) 2001-2003  by  the  Institute  of
74       Electrical  and  Electronics  Engineers, Inc and The Open Group. In the
75       event of any discrepancy between this version and the original IEEE and
76       The  Open Group Standard, the original IEEE and The Open Group Standard
77       is the referee document. The original Standard can be  obtained  online
78       at http://www.opengroup.org/unix/online.html .
79
80
81
82IEEE/The Open Group                  2003                           UNGETC(3P)
Impressum